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

Latest post

iOS Safari window.scrollTo / getBoundingClientRect bug

This is a weird one, and not something you will stumble into every day. But it is a bug nonetheless.

On iOS safari, if you use window.scrollTo(0, y) and y is larger than document’s maximum scroll, any immediate call to getBoundingClientRect will return Same will happen for horizontal scroll and left value.

Read more

Small Mac apps I love

Recently I switched to a new laptop and had to set it up This comic describes my setup pretty accurately. My setup includes a bunch of small apps I found over the years. It seems that most people are not aware of these, so I decided to share a list.

All of them are free (with the exception of TotalFinder), and if you like them, consider donating to authors.

Read more

Uploading files using 'fetch' and 'FormData'

Today I learned:

To upload files using fetch and FormData is supported in IE10+. you must not set Content-Type header.

const fileInput = document.querySelector('#your-file-input') ;
const formData = new FormData();

formData.append('file', fileInput.files[0]);

const options = {
  method: 'POST',
  body: formData,
  // If you add this, upload won't work
  // headers: {
  //   'Content-Type': 'multipart/form-data',
  // }
};

fetch('your-upload-url', options);
Read more

CSS only elastic hover effect

Some CSS fun. Lately I’ve stumbled upon couple of websites with elastic hover effect on buttons. Each one was using SVG morphing, which is fine, but I was wondering how hard would it be to implement it in CSS.

It ended up up being pretty easy.

Read more

JavaScript animation loop

I’ve been really busy lately, doing both work and pet projects. At the moment I’m playing with three.js trying to clone old DOS game to JavaScript. Games (and animations in general) need animation loop in which we are going to update the scene and re-render it.

Example animations are simplified and they just move a box 60px per second. But the concepts applied are universal and can be used for more complicated real life cases.

Read more