My 5th book "50 Tips on JavaScript" is on sale. Go get it from https://50tips.dev.
Illustrated guide to 50 of the most interesting JavaScript topics.

Reinventing the routing in React apps

posted in JavaScript on 2021-01-18   , ,

The router is the backbone of your application. Trust me, that's how it is and I can prove it. One of the fundamental ideas in Web is the URL (Uniform Resource Locator). Or the way of how we very often call it - "web address". No mather what you are building there is a web address which identifies your resource. The router is the front office that accepts the request to particular URL and wires it to a logic. Logic for generating HTML or JSON response or something else. So, the router is very important part of your system.

At the end of last year I rewrote one of my favorite projects - a vanilla JS router called Navigo. I was procrastinating this work for years. Finally I did it in TypeScript and wrote 100+ unit tests along the way. This refactoring opens the door for new features and more importantly, for integrating the library into other places. Like React for example.

read more comments

Transpile to ES modules with Babel

posted in JavaScript on 2021-01-14   , ,

While I was working on Navigo an issue popped out. It was about using the library in the context of Web Dev Server where we have everything in TypeScript. And something was not ok with Navigo. The npm package wasn't exported properly and we were keep getting a does not provide an export named 'default' error. It turned out the problem is that Navigo is not exported properly as ES module (also known as ESM).

read more comments

Mocking console methods with Jest

posted in JavaScript on 2021-01-01   , ,

I'm recently working on two OS libraries. Both I'm unit testing with Jest. There is some logic that leads to a warning which I'm doing with console.warn. In the unit tests this is happening quite often so I want to suppress it. Also I want to verify that it happens on the right place.

read more comments

Copy files and directories from and to Kubernetes pods

posted in Architecture on 2020-12-11   , ,

At work we have a project that uses node:10-jessie image as a base for its docker container. That image has no vi inside so I wondered how to check the content of a file. Luckily kubectl has a neat command to copy files from and to a pod.

read more comments

Replacing code for production with Babel transformation

posted in JavaScript on 2020-11-29   , ,

If you are building some sort of an app, Babel is probably part of your build system. It is that thing which converts our fancy code to valid, working in a browser, JavaScript. Just recently at work I had to design a solution that swaps a class based on the environment. Or in another words, we have logic that should not reach our users. The file should be available locally and on our staging environment but not in production. A tiny Babel plugin was the cheapest solution for me so I decided to share the result.

read more comments

iPhone stuck on the Apple logo

posted in Other on 2020-11-27   , ,

Last weekend I was helping a friend to deal with his "broken" iPhone XR. It was stuck on the Apple logo. No mather what we do the phone was just black and the apple shows up.

read more comments

Transfer MP3 file from Mac OS Catalina to iPhone iOS 14.0

posted in Other on 2020-09-18   , ,

I did transfer MP3 files from my mac to my iPhone three times and every time I'm forgetting how it actually works. So I decided to document the process into a blog post.

read more comments

What the heck is Google Tag Manager and what it has to do with Google Analytics

posted in JavaScript on 2020-09-13   , ,

Just recently I had to do changes in Google Tag Manager at work. It's interesting how I keep forgetting how everything works. So I finally decided to sit down and write an article about these things. If nothing else I will have a good memory snapshot to remind me what is what.

read more comments

You Really Don't Need All That JavaScript, I Promise by Stuart Langridge

posted in JavaScript on 2020-09-12   , ,

JavaScript is your behavior layer; the way to add interactivity to your sites, to provide a slick and delightful user experience, to make everything fast and easy and clean. But at some point everything changed: the tail started to wag the dog instead and development became JavaScript-first.

read more comments

ReactNative: using SVG as a button

posted in JavaScript on 2020-09-07   , ,

Just recently I started using ReactNative. I've been using React for years but this thing is a whole new world. There are tons of basic stuff which I don't know how to do. Using an SVG as a button is one of them. Find my solution below and expect more short #reactnative blog post soon.

read more comments
Old articles New articles