Chris Jarling

Fullstack Engineer
27th Dec, 2017

Leave that shit at home

I suck at traveling. I’m okay in making plans, but then I’ll show up everywhere way too early, be anxious about missing my train/flight all the time and just hate the whole process of traveling.
I especially suck at packing. I tend to take way too many things with me. One time, when I still owned a car, I even took an Xbox and a TV to my parents over Christmas. I take all these things with me because I think they may come in handy at some time. Possibly.
Here’s, for example, what I used to take with me when I was visiting my parents for a few days:

  • My iPhone, my iPad, my MacBook and my Kindle. Of course I’ll need my phone. And my MacBook as well, to get some work done. In my free time, I’ll read a book on my kindle. But what if I want to catch up on my Instapaper or RSS feeds? Sure, would work with my phone or laptop, but it’ll be much more convenient with the iPad. I better pack that as well
  • A physical book. Yes, I know, I packed the kindle, but I started this book a while ago and the trip might be a good time to finish it.
  • My Camera. My parents live in a nice area with lots of nature. I may go out, and I may want to take pictures then. Yes, I already have my phone, but those pictures can’t possibly as good as the ones I’ll take with my SLR. I also better pack some lenses then, just to be safe.
  • A spare part of every kind of clothing I already had packed. Because, what happens if my pants get dirty? Or all my shirts? I better bring a backup pair.
  • Comfortable clothing. Even if I’m just there for one evening, I may want to have some comfortable clothes for the evening. Sweatpants and a cozy zipper!

There’s a lot of “ifs” and “maybes” in the packing list. At the end of the day, I did not even use half of the things I brought with me.
For a while now, I put some effort into minimalizing my life. Mostly, by getting rid of physical things I don’t need, but also in other areas, like my digital life. So when I traveled to my parents over the holiday a few days ago, I tried to involve that minimalist mindset in my packing as well. Here’s what I went with for a 5 day stay:

  • 4x underwear and socks
  • 2 Shirts and 2 Sweaters
  • My MacBook, my Kindle, my Headphones and the matching rechargers (2 cables)
  • My (paper) Notebook
  • Bathroom stuff

I used all of the stuff I packed this time and did miss nothing. I even felt better because I did not have to think about what I want to do and what not so much. I already made that decision when I was packing.
Following are some takeaways.

  • With having packed less, I was able to travel with just my Backpack where I had to take a weekender and often times also my backpack. This makes traveling as a process more comfortable. I have free hands and do not have to look after so much stuff all the time.
  • Cotton sweaters take up loads of space. Even though I’m rolling all my clothes, cotton sweaters take way more space than shirts. That’s just logical, but I did not think about that too much while packing. I’ll probably try to pack more shirts the next time, to save some space.
  • I did not use my kindle. Thats mostly due to a new book I was gifted for Christmas and in an effort to minimalize it as soon as possible, I started reading it right away. In general, packing a Kindle instead of a paperback sounds like a good idea, because you can have all the books in the world with you on one device. On the other hand, it adds a new decision. When you have only one book with you, well, its that book that you’re going to read.

With having packed less, I felt way better than the times before, both during the travels and during my stay. In some way, it’s really a nice way to try out minimalist living for a few days. I’m looking forward to also have that feeling of space when I’m at home.


26th Dec, 2017

On the design of water taps

Water taps are great right? You approach them, demand for clean water and (given they are connected to a water pipe) they just give you some. Not too long ago, that was a task that took people half their days. Heck, even today in some countries thats the case.
The design of water taps is more or less the same across all the various models you can buy. Sure, they have subtle changes, but the vast majority of them has some kind of control atop with which you can control the the amount and (in the most cases) temperature of the water.
It never occurred to me to even think about that design. Thats just the way it ever was. I just accepted it as perfect. If it works for so many people across so many countries for such a long time, water taps surely must be a solved problem.

A few days ago, I watched this video about a guy who lives in an old silo with his daughter (which is, by the way, pretty cool). At one point in the video, he demonstrates his water tap, which is controlled with feet. He says, he’s wasting a lot less water this way, and since the house is not connected to the grid, they need to be mindful about the amount of water they use.
And he’s definitely right. When I’m washing my hands, while applying soap, the water is running for a second or two, when it really doesn’t have to be. This might not be a huge amount of water, but it sure will add up over time.

Having foot controls on a water tap seems to be a huge improvement. So why are almost none of the water taps you see controlled by foot? A quick google search did not yield many results. There is one entry on quora that asks this exact question. Some people do have some valid points there.
For example, you cannot control the amount an temperature of water with a basic foot control. While that is true, I’m sure there are some ways to work around this and make such controls possible. Another valid point is that people that cannot use their feet for any reason may not be able to control the tap that way.
It seems like a simple foot control is not the best solution for the problem, but neither is the current design of water taps.

What I’m going for with this post is not to challenge the way water taps are designed today (well, maybe a little), but to just point out how things do not necessarily need to be “right” just because they have always been that way. I may have used water taps as they are today for my entire live, but show me a solution to get fresh water that is just as good and leads to 50% water savings for a reasonable price and you'll most likely have a new customer.


20th Dec, 2017

Quicktip: SVG inheriting the color of its parent

TL;DR: Use fill: currentColor on the svg, then control the svg’s color via its parent’s color property.

I decided to start writing down things that I learn. In the first place, for me to remember them. I tend to forget things rather quickly and having them written down helps me remembering . I used to shove everything into this repository, but writing my learnings down here forces me to spend more time and thought with them, so I’ll remember them better. At least thats the plan.
I often tend to think “Oh, thats so basic, this isn’t news to anybody but me, so why should I even write about it?”. But if I searched for it, there’s a decent chance someone else will do the same some day. So, here goes nothing.

I recently found myself in a situation where I built a button with an icon and a label in it. The basic markup looked like this:

const IconButton = ({ someprops }) => (
  <button
    onClick={() => onClick(value)}
    isActive={isActive}
    syles={}
  >
      <Icon icon={icon} size={40} color={someColor}/>
      {children}
  </button>
)

You may have noticed that this is written in React. The <Icon> component is a rather simple one, that takes an svg path as an icon prop and renders it as an <svg> tag, applying some styling, like the size and the color.

const Icon = ({ size, color, icon }) => (
  <svg width={size} height={size} viewBox="0 0 1024 1024">
    <path style={{ fill: color }} d={icon}></path>
  </svg>
)

By default, the border of the button and its content should be grey, becoming rose on hover.
When I originally wrote this component (as part of my bachelor thesis), I was just starting out with React. So my naive approach was to just listen to onMousenter and onMouseLeave events, to change the color of the button and the icon. Even though all roads lead to Rome, this one is probably the hardest one you could travel on.

When I stumbled upon this component a few days ago, I though that there must be a simpler solution. First of all, the native <button> element already listens to hover events and activates the :hover pseudo-class, so there really is no need to write that logic myself. Changing the border color of the button and the color of the text was as easy as adding the CSS rules to the :hover pseudo-class.
But since the svg-icon had a color fill assigned by the <Icon> class, the color wouldn’t be changed by that.

The next solution coming to mind would be to just change the fill of the svg when the button is in hover state, maybe like so:

.button {
  &:hover {
    // button hover stlying
    > svg {
      fill: rose;
    }
  }
}

While this works just fine, I’m not a fan of the deep nesting and the usage of the child-selector here. But there is an even simpler solution: Providing fill: currentColor to the svg. This will lead the svg to adapt the color provided to its parent through the CSS color property.

So, for my particular use case, I just changed the default value of the color props in the <Icon> component from white to currentColor, so the icon now just inherits whatever color the parent element has when not explicit color is provided. Everything else came down to some CSS rules for the button.


25th Nov, 2017

The state of the internet

The internet has eaten the world. Where in older days, respect was everything, now information has taken that place.

Here's Tim Berners-Lee, the inventor of the internet on his feelings towards its current state in the Guardian:

“I’m still an optimist, but an optimist standing at the top of the hill with a nasty storm blowing in my face, hanging on to a fence,”

You may already feel in a similar way. If you don't, you should then go on and read this article by James Bridle, in which he talks about what grotesque things happen to see the light of day when content is only produced to satisfy ranking and search algorythms, not humans.

Someone or something or some combination of people and things is using YouTube to systematically frighten, traumatise, and abuse children, automatically and at scale, and it forces me to question my own beliefs about the internet, at every level.

Oh boy, where are we heading with this?

Newer posts
© 2024 Chris Jarling