hjertnes.blog

Future MacBook Pro

26.01.2018 01:00

I don’t think it’s a huge secret that I’m not the biggest fan of the current incarnation of the MacBook Pro. But there are also stuff I love about it.

Let’s begin with what I don’t like:

  • Keyboard. I don’t care if they make the kind of keyboard I prefer. But I do want a keyboard I know will work reliably all the time. All my MacBooks up until this one have given me that. Apple got to either fix their current keyboard, or go back to the old one and make sure that they are reliable.

  • SD slot. This is not a must. But my life and the life of everyone that owns some kind of camera would be better if it was built into the machine.

What I like:

  • USB-C. I love that thing. I can use the same brick to charge my iPhone and my Mac. And I can also get power over the same cable I use to connect an external screen to my Mac. (I use the LG 27″ USB-C screen; I have one at home and one at the office).

  • Screen. It’s awesome.

  • Function key row versus Touch Bar. This should not be a separate model, but rather an option.

Superstruct

26.01.2018 01:00

I stumbled upon this GitHub project a few days ago. It’s called Superstruct, and it looks like an awesome way to validate data in Javascript.

Let me explain. You probably want to make sure that you get the kind of data you expect as input in Javascript, either from your backend API or validating the data that comes as body in your API. But doing so by hand can be very cumbersome. And I thought adding something like TypeScript is a little bit heavy handed.

Superstruct is a simple but compassable way to validate some object, you can add simple values or more complex validation code. And it throws and error if there is any issues with the data.

#

25.01.2018 01:00

```text ```

```text ```

Let’s see how this looks.

#

25.01.2018 01:00

[@belle]1 checked out the podcast a few days ago. It’s awesome!

#

25.01.2018 01:00

2017-12-11

```text ```

Grainy as fuck, but a great black and white film.

2017-12-31

```text ```

My analog kit. Nikon FM and Series E 50mm f/1.8

#

25.01.2018 01:00

Picked up the diploma for my philosophy bachelor today, because going to the actual graduation sounded like torture. And it took me six months to pick it up, because I care more about the journey than the destination.

I’m still proud of the B I got in Wittgenstein studies though.

#

25.01.2018 01:00

Onward for The Cramped – The Cramped

I don’t post things for the sake of posting things to keep you “engaged” with our “content”.

Optimizing React-Redux

25.01.2018 01:00

If you need to tune React performance, I would guess, that most of the time it will be about render time. And there are many ways to deal with that. The basic idea is that you want to make sure you don’t do it too much, while still doing it when data change. My experience is that it is more about just re-rendering once when something change.

The best place to start is to make sure you use PureComponent instead of Component as a base for all of your components. And then make sure you connect your data from redux just where you need to. This means that you add the data exactly where you need it, and that you don’t send more data than needed.

And then I’d take a look at the following methods options in react-redux.

The react-redux Documentation:

When options.pure is true, connect performs several equality checks that are used to avoid unnecessary calls to mapStateToProps, mapDispatchToProps, mergeProps, and ultimately to render. These include areStatesEqual, areOwnPropsEqual, areStatePropsEqual, and areMergedPropsEqual. While the defaults are probably appropriate 99% of the time, you may wish to override them with custom implementations for performance or other reasons.

It will be overkill to do much with it in most apps, but all of the methods mentioned above containing “Equal” can be very useful to make sure that you only trigger updates when you need to. But don’t do it just to do it; the result will almost always be worse than the default. And tuning this kind thing is only for very special corner cases.

Testing Out Sunlit

25.01.2018 01:00

2017-11-04

```text ```

2017-11-11

```text ```

2017-11-12

```text ```

#

24.01.2018 01:00