Hjertnes.blog

#

October 30, 2017

I can’t say that I love any of the iPhone X colors. The grey isn’t dark enough;and silver is silver. If I would get one, I’d get the silver. And that’s the first time I’ve considered anything except for black or grey. It helps that they have gotten rid of the horrible white frame

Basic Auth Sample

October 30, 2017

There are times where you need and want something full featured with a user firendly authentication and registration system, and there are other times you just want to put a resource behind some kind of authentication system.

<a href="https://github.com/hjertnes/basic-auth-sample">THis</a> Express project does the latter. It let&#8217;s you define username and passord as enviornment variables and are using the built in support for HTTP Basic Auth in your browser to manage it.

I think it is the perfect option for simple tools that aren&#8217;t intended to be used by anyone outside your org. For example for backend or monitoring systems.

Object.assign

October 30, 2017

One very cumbersome operation in Javascript in the past, was the process of combining multiple objects. For example taking the output of multiple methods, combining them, before passing them on. There have been some good and some horrible and some less horrible ways to do this in the past. I used to either do it manually or to looping over objects, which wasn’t the most convenient thing in the world before ‘for in’. This is very easy to do with Object.assign.

The way it works is that you can give it any number of objects as arguments, and it combines it into a single object. And if a key exist in multiple of the inputs it will use the <strong>latest</strong>. As you can see in the example above. </div>

#

October 30, 2017

Interesting iOS 11 change.

October 29, 2017

It seems like there is a change to how app updates work for apps that are in use.

The way it used to work was that if I for example were listing to a podcast using Overcast, and hit update all, the app would exit when it was time to apply the update. And now it seems like the update will not be applied before the app exists.

I’m not sure how I feel about this change. On one side is it nice that the app don’t suddenly exists. But on the other side do I prefer that a “Update all” button does exactly that – updates all of my apps.

#

October 28, 2017

A few thoughts about the iPhone 8 camera

October 28, 2017

The new “tele” lens on the iPhone 8 Plus is awesome. Even though I would consider it a normal lens and not a tele.

I’m not a huge fan of the portrait mode thought. It looks a little bit weird compared to the real thing.

But to have both a wide and a longer lens makes the iPhone a much more capable tool as a very versatile camera. Now we only need a real tele lens I’m addition and a setting to default to the one you prefer.

#

October 27, 2017

I do think the iPhone X is interesting, but I’m very happy that I ordered the 8 Plus instead because waiting for the X with a broken 6 Plus would have been very annoying. Not to mention how broken most apps will be until developers get a chance to update them.

#

October 27, 2017

Not enough coffee or not enough sleep this week.

For-of

October 27, 2017

For of is one of a few recent additions to the for loop in Javascript. It makes it possible to do what is basically a foreach in most other programming languages, like for example C#. for(var item of array){} is more or less the same as foreach(var item in array){} in C#. Why not just use .map or .forEach? Well, I usually do, but to do that can be a little bit cumbersome when you are dealing with async methods and async await, because then the arrow function in the .map also needs to be async etc. And it is nice to have an fast way to just loop through an array without having use a old school for loops. They are useful sometimes, and you should know how they work, but it is nice to have a quick and easy way to just loop thorugh an array.