hjertnes.blog

#

09.12.2017 01:00

My first impressions after being in the process of importing all of my raw files into Lightroom CC is that it is that I wish LR was when I got started with it. It might not be what most power users want. But it looks promising.

#

08.12.2017 01:00

I think the basic premise of MeeToo is a good one, but what I don’t appreciate is the lack of understanding between the difference of harassment and sexual harassment. It seems to me that all harassment are treated as and discussed as the same.

Adding stuff to the prototype.

08.12.2017 01:00

So, you have written a neat little utility function to do something with for exampel arrays. That you are going to use all over your React app.

I’m not going to start a religious war there, but you should read this before you start adding stuff to the prototype of objects you don’t “own”.

Let’s say you have written a method called “found” because you don’t know about “find” or because you prefer to get back null instead of undefined. I’m not saying this is a good idea, I would go as far as to say it is a horrible idea. But my point here is mearly to show what is possible. Extending the prototype is a powerful tool though, useful to work around browser bugs or to get around limitations of older browsers.

You could do something like this:

The problem with this is that then you need to import this function (or even worse copy paste it) into each place you need it. Another way to solve this would be to add it to the Array prototype:

There are many reasons to why you shouldn’t do this. The main reason is what I call the jQuery plugin problem: what if two pieces of code extend the same object to the same value. For exmaple, what if you use a plugin that extend the prototype by adding to the same name, but works differently?

Summary: a very powerful and useful trick to have up your sleeve, but it might not be the best to use it on objects you don’t “own”.

Iterators

07.12.2017 01:00

An iterator is the underlying structure of arrays and everything else you can loop over using for example for-of. You probably don’t need to implement one yourself, unless you are trying to make something that is Lazy. A lazy iterator is when it continues to iterate as needed.

The basic idea is that you add a symbol (I’ll add a example below) that returns a object, with a next method, that returns an object with two keys: value and done; done is a boolean telling the code that iterates over the iterator if it is the last element or not.

#

06.12.2017 01:00

I’ve been very skeptical about Lightroom CC; especially about not having a copy of the images locally. But I think I’m going to give it a shot, now that I have enough bandwidth to do it. But, first I need to find out how to back it up.l

Promise Functions.

06.12.2017 01:00

I have talked a lot about promises before. Some people think they are a unnesseary complcation of simple callbacks. I disagree, because async await makes it possible to make code a lot more readable, especially if you need to do a lot of stuff that would have callbacks. But I have not talked that much about two methods that live in the Promsie prototype: all and race.

Promise.all is a method you can use to resolve any number of promises, and it will not resolve until all of them are resolved. The result is a iterable of the result from all of the promises, in the order they were in the array to passed to Promise.all.

Promise.race on the other hand also takes an array, but will resolve when the first promise resolves. Useful if you for example have multiple ways to fetch some kind of data, and you just want the any of them.

Pug

05.12.2017 01:00

Pug is a template language for Javascript that I have grown to enjoy a lot. My impression is that a lot of people use it, if they use a templating engine for server side rendering using Node. The big question is if you need it or not in 2017. I personally believe that there is a place for it, when you just want to put to gether something really simple, where the interactivity of a full fledged front end system like React or Angular would be overkill. But you could probably make something similar yourself with template literals if your needs are really simple.

But I personally just go with pug, because the syntax is elegant and easy to learn. It performs well. And it is really easy to use it with Express.

#

04.12.2017 01:00

👌 Liked: 1Password CLI

Filling the Vanishing Point

04.12.2017 01:00

I do love my Vanishing Point. AndI guess it is the pen I use the most. But there is one thing about it I’m not that fun of. And that is how much of a pain in the ass it is to fill it when your ink bottle gets low.

Like I have said many times before, the Pilot Vanishing Point is a pen with a lot of compromises that are necessary to get a good, reliable, retractable fountain pen. sing that converter I hate.

This problem on the other hand has to do with the nib design, which I assume is that way because it was needed by the mechanism. Anyways. The problem is that the place where the ink are sucked into the pen, is very high on the nib; much higher than most pens. That means that the point where you can problems filling your pens from a bottle of ink will be much sooner with a VP than any other pen I own.

Review of my iPhone 8 Plus.

04.12.2017 01:00

My iPhone buying strategy have always been to use them until they break or the battery is useless. How much time that takes varies, but it is always between two and two and a half years. What happened this time was much more dramatic. I broke the screen of my 6 Plus a year agp. And then I started to see some signs of watar damage after I waled the dog.

The result was that the phone slowly died over that night. And I ordered the best possible replacement the morning after. It wasn’t without compromises.

My original plan was to wait until the iPhone X was available. But going without a phone for a few weeks or months wasn’t an option; because everything from two factor authentication for banking to my train season ticket is on my phone.

My revised plan was to get a either a 8 Plus or a 7 Plus; basically the best one available to be sent “now”. I went with a 8 Plus Space grey. The 64 GB model.

It’s kind of strange that I’m on the lowest storage option now. On one side is it good that Apple have phones, where the cheapest one is usable. But on the other side I realize that it might just be that my needs are going up much slower than the rest of the world.

What do I think about it? I love it, it is more or less the same as my 6 Plus. Just faster, newer and better. But everything feels familiar. There is a little bit more “grip” to the surface of the 8 and X phones compared to the previous models (excluding the JetBlack). But I would still recommend getting either a Apple leather or silicone case; I got the latter.

This is the kind of upgrade where I would be fine with a faster version of what I had. But there are also some new stuff. Like for example the extra camera lens. I love that my phone now has both a 28mm and 50mm equivalent lenses; meaning that what you see is more or less the same as you would with a 50mm and 28mm lens on a full frame or a 35mm camera.

I’m not sure how I feel about the lack of a headphone jack. There have been times where it bothered me. My PowerBeats were on repair, and I had to charge my phone and I wanted to listen to podcasts. But I use my bluetooth PowerBeats most of the time. So, not being able to charge while using headphones isn’t something that affects me a lot.

Anyways. A great upgrade, if you want a new phone fast. Or if you just want a better version of what you had.