Carsten Ruhr

Notes

A super simple dice parser

I just published another open-source package. And again something that probably already exists somewhere out there. But I wanted to scratch my itch myself. So I created a tiny library that parses a string in the standard dice notation and ...

Photo section

I just put up my photo section. It's not very well optimised, but maybe that's something for the future me. It bothered me that I was relying on Instagram to have my own little gallery, so I decided to replace it with a simple gallery on my own ...

Another website rewrite

Yes, I re-wrote this website again... For some reason Remix felt slower to me than it should. I also had it happen, that the remix production server crashed from time to time. But I am not sure if that's actually Remix's fault or if there is ...

My first open source package

Recently I published my very first open source package. It's a 2D Vector library. I know, I know... We have dozens of them. At least. And I don't assume anybody will really use it. But I always thought about putting something open source out ...

Website rewrite

I finally rewrote my website in Remix with a pocketbase backend. Not because it was necessary, but because I always wanted to try out pocketbase as a replacement for the horrible .mdx file handling I had to do for those notes. It's pretty ...

NextJS 13

Another day, another Framework release. This time it's the release of NextJS 13.0.
So let's have a look at the most interesting new features: Layouts For this, we need to know that routing changed a bit in NextJS 13. Instead of ...

The Offscreen Canvas

For the Mythical Ink Dungeon Generator I made heavy use of the canvas element. For drawing the final dungeon as well as drawing partials and masks to not-visible canvas elements to add them all up together to a final result. Those invisible ...

Make sure to abort fetch requests on unmount

If you use a useEffect hook in React to fetch some data from a server, you should make sure to cancel this request when the component gets unmounted.
To be honest, I am quite guilty of a fire-and-forget mindset when it comes to requests. But ...

Use Intl.ListFormat() instead of join(", ")

@ericclemmons tweeted that you should use Intl.ListFormat() instead of string.join(', '). I wish I had known this way earlier.
const vehicles = ['Motorcycle', 'Bus', 'Car'];

const formatter = new Intl.ListFormat('en', { style: 'long', ...

Map and WeakMap in JavaScript

In JavaScript most of the data structures are represented either as primitives, arrays or objects (I know, strictly speaking arrays are objects - but you know what I mean). And for most cases, that's all you need. But sometimes you find ...

VSCode in GitHub

Did you know you can open VSCode directly in GitHub? I just found out (thanks random YouTube recommendation).
To open a repo in VSCode just go to any GitHub repository and press .. From here you can do most things you can do locally. Saved ...

TIL array.at()

Another small function I just learned about. myArray.at(x) works almost like myArray[x]. But the new .at() method has one awesome advantage. It supports negative indices which lets you access an array from the end. Negative indices with the ...

NextJS 11.1

NextJS 11.1 just has been released. And as a fan of this react based framework I am always excited about news on this front. The release is mainly about build time improvements and fixes a security issue. But one remarkable change is the switch ...

NodeJS Security Cheatsheet

I found this nice NodeJS security cheatsheet today. While I already follow a good cut of this guide there are three things I did not consider yet.

Limiting the request size

Makes sense. You don't want anybody to send gigabytes of data and ...

Tempura Template Engine

More a bookmark than anything else: The Tempura Template Engine might be a good fit for my mailing system I am currently writing in node. It has handlebars syntax and is extremely lightweight.

WEB NFC

Today I learned that in Chrome 86 and above you can read NFC tags. I really want to play around with this. But I am yet missing a cool use-case apart from the obvious (payments).

Upcoming JavaScript Features

I recently stumbled upon this blogpost describing some upcoming features of ES2022 in short. I did a bit more research on upcoming ES features and summarised my findings. They are in no particular order and might not even make it into ES2022.