Clear

git diff by word

The default diffing algorithm for git diff is by lines. There are scenarios where it’s more interesting to diff by word, for example: long lines. In that case it’s useful to use --word-diff=color.

Docsify Mermaid 10

Using Docsify and Mermaid 10 can be tricky since Mermaid 10 renders asynchronously (mermaid.render returns a Promise). This post shows how to work around the mismatch between Docsify’s markdown.renderer.code and Mermaid’s render...

Add days to a Date in vanilla JavaScript

Despite the JavaScript Date warts, it’s straightforward to add day(s) to a date in JavaScript. While it would be very easy to reach for moment.js or another date manipulation library (date-fns, luxon, dayjs) to do something as simple...

The Future of PHP: Is It a Dead Programming Language?

There’s an opinion that PHP is dead today, but is this true? Should we believe in this or only people who don’t like PHP are sharing this news? Why do people hate PHP? Let’s take a closer look at PHP and try to predict its...

When to use Jest snapshot tests: comprehensive use-cases and examples 📸

There’s some nice use-cases for snapshot tests outside of the well-travelled React/Vue UI component ones. In other words, although React and Vue testing with snapshots is pretty well documented, that’s not the only place...

Clear Module Cache/Force Import in Node.js with CommonJS and with ES Modules (ESM)

Node.js supports two primary module systems: CommonJS and ES Modules (ESM). Both systems cache imported modules, ensuring that a module’s code runs only once, even if it’s imported multiple times. When writing tests it can be...

Tips For Students Choosing Their First Programming Language

More and more colleges offer their students the opportunity to try their hand in coding. With technologies continuing making massive inroads people’s our everyday lives, such professions as a computer programmer, web developer,...

6 months of Code with Hugo, in numbers

Going from 0 to small. A developer’s journey starting a technical blog from scratch. Stats in this post as of 21st of October, follow me on Twitter for monthly updates. Contents:

Jest assert over single or specific argument/parameters with .toHaveBeenCalledWith and expect.anything()

With Jest it’s possible to assert of single or specific arguments/parameters of a mock function call with .toHaveBeenCalled/.toBeCalled and expect.anything(). The full example repository is at...

The step-by-step guide to create a domain redirect with Cloudflare

Redirecting a whole domain using Cloudflare can be useful but isn’t documented anywhere, here’s how to do it.