Hello, I'm Stanko, a software engineer in Belgrade, writing mostly about JavaScript and React.

Latest post

One million npm downloads

I want to brag a little - my npm packages have been downloaded more than Stats are coming from npm-stat.com. this year!

Image showing yearly download stats of my npm packages

And I finally got a real domain:

https://muffinman.io/

I’ve been quiet for the last couple of months. Mostly because I was busy with other things, both work and personal. But I do have a few small side projects I will be sharing soon.

Stay tuned!

You can fix lumpy Joy-Con using hair dryer

I love my . I have a huge draft about Switch, and how it have put the fun back in gaming for me. It takes me forever to publish it. Unfortunately, tonight I noticed that one of my Joy-Cons has weird lumps on it.

Lumpy Nintendo Switch Joy-Con

(This is the image from the internet, not mine.)

On multiple forum threads, people suggested using hair dryer to fix it. But nobody did explain how. I tried it, and in couple of minutes I managed to get it, and here is how I did it.

There are tiny inserts in the cap, and they need to go in to the tiny holes on the joystick. I had three of them fall out. To fix it, just heat it with the hair dryer (I did it for about ten seconds), carefully adjust one insert and rub it a little bit until it falls in. Repeat for each insert.

It was much easier than I thought it would be (before heating it felt impossible). Hopefully they won’t fall again, but I will probably get thumb grips to be sure.

JSON.stringify removes undefined and how to keep it

This is something I keep rediscovering, because I keep forgetting it. JSON.stringify will omit all object attributes that are undefined.

In most cases, it doesn’t really matter, because if we parse that string back, and try to access that attribute - it will be undefined by design. Check the example below:

const user = { name: 'Stanko', phone: undefined };
user.phone; // -> undefined

const stringifiedUser = JSON.stringify(user); // -> "{\"name\":\"Stanko\"}"

const parsedUser = JSON.parse(stringifiedUser) // -> { name: "Stanko" }

// At the end it behaves the same
parsedUser.phone; // -> undefined
Read more

Flex justify content equally distanced items

1 Comments

I want to share a hack (or a trick if you prefer) my colleague Marko showed me today.

What is the problem? We want our flex items to be equally distanced between each other and from the parent’s edge. Unforunately I wasn’t aware of this property, thanks Marc for mentioning it in the comment below! is not supported in IE and Edge. And space-around or space-between won’t work.

You can see what we are trying to achieve in the first row, and how the latter two are behaving.

Flex justify content examples

Read more

CSS and SVG input animations

Yesterday, one of my colleagues shared UI Movement website. It resulted in me playing with random animations trying to replicate mockups I liked.

Here are the results: