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

"has-tabbed" aka "Should I release small libraries?"

I just released tiny library called has-tabbed. Again, it is a small piece of code I regularly copy from project to project. I always considered it too insignificant for releasing it as a standalone package.

When user presses tab key, it adds By default --tabbed is used, but it accepts custom class as parameter. to html element. Then, if user clicks anywhere on the page, it removes it. That’s why I though it is too small. But after giving it some thought, my answer to the question in the title is “YES”.

You should release small libraries no matter how small they are.

Read more

Marvin v1.0

Marvin just got better!

Few days ago I’ve released version 1.0 of my Also known as Marvin There are some big changes, and I’m pretty happy with it’s current state. At least 20 applications were shipped using Marvin. It has about seven hundred stars on GitHub with quite a few community contributions.

Read more

My programming story

This was intended to be a single paragraph in the post I’m still writing. It ended up much longer so I decided to publish it on it’s own. So without further due, I present you my programming story.

Read more

Consume less, create more

That’s my new year’s resolution. Code, write, play and craft more!

Get scrollbar width in JavaScript

2 Comments

Another onliner I love, that returns body scrollbar width. If scrollbar is not shown it will return zero (including mobile devices).

function getScrollbarWidth() {
  return window.innerWidth - document.documentElement.clientWidth;
}

Click on the button to try it yourself:

Browser support

Tested on:

  • Windows: IE9, IE10, IE11, Edge
  • MacOS: Safari, Firefox, Chrome, Opera
  • iOS: Safari, Chrome
  • Android: Chrome