PS. If you’ve ever unsure about something in programming, just open up your interpreter (if you have one) or a new file and create a quick spike (test). Sometimes it’s even faster than reaching for the search engine and plus, you’ll learn more ;)

(It’s not a huge difference either way but good to know that you don’t have to avoid using static properties because you might be worried about performance.)

Show thread

I used to think that file scope lookup would be faster than static property lookup on a class but, empirically, the inverse appears to be true under v8/Node.js:

class Constants {
static constant = 'I’m a constant'

const constant = 'I’m a constant'

class OtherClass {
constructor() {
// This is faster:

// Than this:

new OtherClass()

(I was testing with 10,000,000 iterations+)

PS. Still a good idea to use well-named constants and comments to describe exactly what you’re trying to achieve with a regular expression, of course. Given how cryptic they can appear to the uninitiated (or to you in two weeks’ time) :)

Show thread

If you’ve been writing JS for a while, you might take it as given that you should create constants of your regular expressions instead of using literals directly in loops as the former is faster. Well, it might have been once but it’s not any longer. Just did a test myself to prove it but this article also goes into why: (TL;DR: the engine is smart enough to optimise for reused regular expressions at runtime).

Just released JavaScript Database (JSDB) version 1.1.1.

This is a minor bug-fix release.

- Improve query sanitation.
- Fix boolean value handling in queries.

To install:

npm i @small-tech/jsdb

Learn more about JSDB in this blog post:


Thanks to @debian 's €10,000 donation (and not $10,000 as announced a few hours ago), we've just reached the 4th step of our PeerTube fundraising. Many thanks to all those who donated. And it's not too late to contribute :

In an effort to save democracy, Twitter will henceforth be displaying all tweets in Pig Latin.

Just released JavaScript Database (JSDB) version 1.1.0.

This is a security update. The first version was already sanitising strings at serialisation to avoid arbitrary code execution via injection attacks but now it also performs basic sanitisation of queries also (hello, Little Bobby Tables).

To install:

npm i @small-tech/jsdb

Learn more about JSDB in this blog post:


Introducing JSDB

“It’s all JavaScript… What I mean by that is that even the data is stored as JavaScript code. Not JSON. JavaScript.”

Then, just like that, it came to me in a dream, John… the answer, it was right there in front of our eyes all this time… two taps, John… two taps to retweet! Humankind can breathe easier tonight.

Jack: We must save democracy!

Me: So you’re ready to admit that your company’s business model – not to mention your very own status as a billionaire – is toxic to human rights and democracy?

Jack: Two taps to retweet instead of one to save democracy!

Introducing JSDB

“It’s all JavaScript… What I mean by that is that even the data is stored as JavaScript code. Not JSON. JavaScript.”

New version of Extraterm is out. Includes my tiny oh-my-zsh prompt corruption fix as well as an “insert emoji” command and more :)

Oh yay, with the latest updates it seems my system settings are back to persisting correctly. No more having to uncheck/check natural scrolling and my compose key every time I restart 🤞

To fix:

1. sudo dpkg --configure -a
2. apt --fix-broken install

Show thread

Oh and would you look at that, a sudo apt upgrade error as well with Pop!_OS 20.04 (wtf, apt is so stable usually)…

dpkg: dependency problems prevent processing triggers for libglib2.0-0:i386:
libglib2.0-0:i386 depends on zlib1g (>= 1:1.2.2); however:
Package zlib1g:i386 is not configured yet.

Apparently I’m not the only one to hit it:

So I go to sudo apt update today and:

E: The repository ' focal InRelease' is no longer signed.

Oh, nice. OK.

So let’s try removing it, then:

sudo apt-add-repository -r ppa:wireguard/wireguard

Nope! (You didn’t think it was going to be that easy, did you?)

Cannot add PPA: 'ppa:~wireguard/ubuntu/wireguard'.
The team named '~wireguard' has no PPA named 'ubuntu/wireguard'

Actual fix:

sudo rm -i /etc/apt/sources.list.d/wireguard-ubuntu-*

Show more
Aral’s Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!