hjertnes.blog

#

16.01.2018 01:00

Every time I use the portrait mode on my iPhone I end up reaching for my X-Pro 2

#

16.01.2018 01:00

Bye bye productivity – the next 12 hours. I decided to do a fresh install on my MacBook Pro.

Structure

16.01.2018 01:00

A few words on structuring your react app. Don’t think too much about structure, keep it as flat as possible, for as long as possible. Use redux to make your state sane, and use higher order components to limit code duplication. But keep one component per file.

I’m a fan of structuring stuff when it hurts to not do it. Then I would look into making modules out of the stuff that is just used one place.

Let’s say you have a route where you add and edit blog posts; have all the stuff that is just used there in a folder, and then have the main component you use in the Editor in the moduleFolderName/index.js.

React won’t solve any of your problems with sturcturing your code base, but neither will anything else.

But one thing that is more imporant than most is to use eslint. Base it on a sane set of configurations like the airbnb one and modify it to fit your requirements. Linting is a good way to keep your codebase sane and a good way to filter out some stuff.

It won’t replace automated testing or proptypes but is a important addtion.

One last thing I personally think is important to think about when you have a large app, try move everything that is used multiple places to a single place. And then try to make sure that each module in your component structure never import outside of it’s own folder, except for state and common. I also always start with the following structure: state(everything related to redux), utils(javascript code) and components(react code).

#

15.01.2018 01:00

It’s my first Micro Monday participation. If you don’t already, start following [@eli\](https://micro.blog/eli) her links are the best!

More retractable fountain pens

15.01.2018 01:00

So, if you want a good retractable fountain pen, you have one good option. And I have only seen one other option, which isn’t that good to be honest.

On one side you have the Pilot Vanishing Point and on the other you have the Lamy Dialog 3.

I have a VP and I love it, even though it has some constraints. The short version is that it is a special pen, where Pilot have made many hard choices in order to get a pen that is as good as it is. But that means that it won’t be a good fit for many people. The biggest problem with it is that the clip is kind of annoying for some people, doesn’t hold enough ink, and that it is a pain in the ass to fill when you ink bottle runs low.

My impression when I was going to get a retractable pen, and spent some(a lot) of time researching is that the Dialog isn’t that great. I might get one at some point, but not now.

Here is the thing: we need more retractable fountain pens. To get some fresh blood and some competition in this market where Pilot and their Vanishing Point dominates. I get the engineering problems with making it. But I want more competition here. Because many people cannot use the only good retractable fountain pen available, because of the clip.

It would be really awesome if someone started to sell the mechanism, and then as a result a lot of different pen designs based on it.

Spacemacs

15.01.2018 01:00

There is some confusion about what Spacemacs is for some strange reason. A lot of people seems to believe that it is a fork of Emacs. It might be beause of the writing on their website, that kind of supports that statement. But it is wrong. What Spacemacs is, is rather simple, it is a git repository that is a emacs configuration. It comes with a lot of great features out of the box and it also auto updates. And it also has a special way of configuring your emacs setup.

There are many good things about that. It does make it easier to get started with emacs, because most of what most users want works out of the box, as long you activate the right “layers”. And the way you configure spacemacs also makes it less likely that you end up in “emacs.d bankrupsy.”. Something that we VIM users used to mock emacs users for. It is when you end up in a place where you can’t figure out how to fix your config and have to delete it.

Webpack

15.01.2018 01:00

Webpack is your compiler, and learning how to use that tools shouldn’t be the first thing you do, because a lot of people will probably give up before they get started. I think that most experienced developers should understand what the webpack configuration does. And all teams should have at least one person that can wrangle together a config file from scratch.

I say, start with create-react-app, then learn how to write react code, and then learn how webpack works when you have a thing you need to do that create-react-app can’t do.

It isn’t that complicated really. You have a entry point (the javascript file where webpack will begin) some configuration of how you want to transform your code, some configuration of how the output should be and that’s it. The great thing about using something like webpack is that you can build everything from your javascript code, and styling plus generating HTML files (both for development and production). You can for example add a hash to the file names to avoid caching problems in production.

I typically start with create-react app these days, and then move on to using my own webpack, if or when I need to.

#

14.01.2018 01:00

#

14.01.2018 01:00

I’m going to do my best to not make jokes about checks and health care in America this year.

#

14.01.2018 01:00

hjertnes/mb.el: A Emacs Lisp function to post to Micro.blog’s