JavaScript

JavaScript: essays on type checking, curried functions, self-describing code and performance, plus WebGL demos and browser games.

Key Hunt

A real-time multiplayer game with up to 32 players in each arena.

27 September 2026

Asteroids

A real-time multiplayer game with up to 50 players in each arena.

13 September 2026

A scalable real-time signal system in PHP and Node.js

A method for scalable real-time signalling in PHP and Node.js.

21 April 2026

Some JavaScript performance comparisons

In JavaScript there are often many ways to achieve the same common things

14 March 2025

React 19: Improvements to Suspense (but still not a whole solution)

React 19 lets you hand Suspense a promise, but you still have to keep your promises.

12 December 2024

Taming React 2: mutable variables

Keeping a React value and its setter together in one variable, named with Mutable on the end, so components and hooks take one argument where they took two.

13 August 2024

Taming React 1: composable state with useStateField

React components that each work on part of a big state object, using a useState-style pair for any field instead of a reducer action for every change.

16 July 2024

Making a node module which works both on frontend and backend

If there's some logic which needs to run on both the frontend (JavaScript/HTML) and the backend (Node.js), there are some patterns which let you use the same module in both places.

12 April 2024

The Ai module

A JavaScript module to perform AI tasks with a convenient async interface.

14 August 2023

Endless music with MusicGen

Getting an AI music model to keep playing, in time, for as long as you like.

7 July 2023

Comparison of JavaScript binary data objects

There are a set of objects for dealing with binary data in JavaScript, which are slightly different on NodeJS and in the browser.

15 March 2023

FastArray (draft)

A fast array is a trie-like data structure that allows for fast insertion and removal of elements at any index. It is useful for cases where you need to insert and remove elements at arbitrary indices in an array-like data structure.

15 March 2023

3D Script IDE

This is an interactive environment for creating 3D animations using a simple scripting language.

14 March 2023

A pure JavaScript CPU emulator

A CPU takes instructions from RAM and acts on them: a working emulator for a tiny one in plain JavaScript, a loop and a switch.

14 March 2023

Rocks Off

Write-up to come.

11 March 2023

The Dodge Game

Write-up to come.

11 March 2023

Parsing self-describing JavaScript code

It is possible to write code in a manner that allows you to choose whether to execute it or grab a description of what the code does as an Abstract Syntax Tree. All using the same code.

22 January 2023

Self-describing code

It is possible to write code in a manner that allows you to choose whether to execute it immediately or grab a description of what the code does as an Abstract Syntax Tree. All using the same code.

19 January 2023

A Docker module for Node.js

Starting a server should be one function call, with the Dockerfile written by the code that knows what the server needs.

24 May 2022

A hash table you don't need to rehash

An immutable hash table that grows without ever being rehashed, and shares almost everything between one version and the next.

7 May 2022

Suspense for data fetching in React 18

What React Suspense does and how to use it without a framework.

5 April 2022

Declarative programming

Write-up to come.

14 March 2022

Using context in JavaScript to achieve cleaner code

Write-up to come.

14 March 2022

Exceptional parsing

Parsing is one of those intermediate-level algorithms, which, like state machines, you may not use on a day-to-day basis as a developer but their understanding helps with your mental model of programming.

11 March 2022

How I organise Node modules

A module is one tree of names, and every name is written out in full wherever it's used.

21 August 2021

Simple typechecking goes a long way

Most bugs in plain JavaScript are a value of the wrong type, so it pays to check them at the door.

29 June 2021

Type safety at the boundaries

Checking data from the outside world once, as it arrives, with FromJson functions and a small assert library instead of a schema library.

17 November 2020

3D components in Angular with three.js

Write-up to come.

6 October 2020

Composable typechecking in JavaScript

Catching type errors early in plain JavaScript with small type checks that compose, including checks for objects.

9 July 2019

Curried functions in JavaScript

Curried functions exists in some programming languages and they are functions which have been called without all their arguments. This yields a new function which has the remaining arguments, which can be called with those arguments to get a return value from the original function.

7 July 2019

An RxJS primer

Treating everything that happens over time as a stream you can transform and combine.

16 October 2018

Simulating algebraic effects in JavaScript

Write-up to come.

26 September 2018

Simple speedups

If you have a Web application there are likely countless ways you can speed it up, some with significant performance gains, and some adding up to significant gains if you apply enough of them.

16 March 2018

FractalToy

Online Real-Time Fractal Explorer

15 January 2015

Clip3D

Online Game Creation Tool

14 January 2015

GLSL fractals

Animated Fractals with WebGL & GLSL

29 January 2014

SWF disassembler

A disassembler and decompiler for the ActionScript 1 and 2 in Flash SWF files, in JavaScript for Node.js.

23 September 2012

GLSL raycasting

Raycasting inside a GLSL fragment shader.

9 September 2012

WebGL raytracer

WebGL is quite effective at raytracing simple scenes with a decent frame rate.

26 December 2010

The Google V8 engine

Google have been working hard to make JavaScript fast.

6 April 2010