hjertnes.blog

#

31.10.2017 01:00

iPhone Ex.

#

31.10.2017 01:00

“Sometimes, bad things happen, and there’s nothing that you can do about it. For these cases, Rust has the panic! macro. “ — The Rust Programming Language

#

31.10.2017 01:00

What’s the deal with pumpkin flavored anything?

Looping over an Object

31.10.2017 01:00

There are two ways (that I’m aware of) to loop over an object in plain Javascript; either use the for in syntax, example number one below, or by using Object.keys, see example number two.

```text I personally prefer the fist method, because it involves less typing, but the second example might be easier to understand, if the developers on your team aren’t familiar with the difference between for in and for of. ```

#

30.10.2017 01:00

#

30.10.2017 01:00

#

30.10.2017 01:00

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

#

30.10.2017 01:00

Basic Auth Sample

30.10.2017 01:00

```text 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. ```

```text THis Express project does the latter. It let’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. ```

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

Object.assign

30.10.2017 01:00

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>