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 2026Asteroids
A real-time multiplayer game with up to 50 players in each arena.
13 September 2026A scalable real-time signal system in PHP and Node.js
A method for scalable real-time signalling in PHP and Node.js.
21 April 2026Some JavaScript performance comparisons
In JavaScript there are often many ways to achieve the same common things
14 March 2025React 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 2024Taming 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 2024Taming 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 2024Making 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 2024The Ai module
A JavaScript module to perform AI tasks with a convenient async interface.
14 August 2023Endless music with MusicGen
Getting an AI music model to keep playing, in time, for as long as you like.
7 July 2023Comparison 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 2023FastArray (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 20233D Script IDE
This is an interactive environment for creating 3D animations using a simple scripting language.
14 March 2023A 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 2023Rocks Off
Write-up to come.
11 March 2023The Dodge Game
Write-up to come.
11 March 2023Parsing 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 2023Self-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 2023A 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 2022A 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 2022Suspense for data fetching in React 18
What React Suspense does and how to use it without a framework.
5 April 2022Declarative programming
Write-up to come.
14 March 2022Using context in JavaScript to achieve cleaner code
Write-up to come.
14 March 2022Exceptional 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 2022How 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 2021Simple 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 2021Type 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 20203D components in Angular with three.js
Write-up to come.
6 October 2020Composable typechecking in JavaScript
Catching type errors early in plain JavaScript with small type checks that compose, including checks for objects.
9 July 2019Curried 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 2019An RxJS primer
Treating everything that happens over time as a stream you can transform and combine.
16 October 2018Simulating algebraic effects in JavaScript
Write-up to come.
26 September 2018Simple 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 2018FractalToy
Online Real-Time Fractal Explorer
15 January 2015Clip3D
Online Game Creation Tool
14 January 2015GLSL fractals
Animated Fractals with WebGL & GLSL
29 January 2014SWF disassembler
A disassembler and decompiler for the ActionScript 1 and 2 in Flash SWF files, in JavaScript for Node.js.
23 September 2012GLSL raycasting
Raycasting inside a GLSL fragment shader.
9 September 2012WebGL raytracer
WebGL is quite effective at raytracing simple scenes with a decent frame rate.
26 December 2010The Google V8 engine
Google have been working hard to make JavaScript fast.
6 April 2010