11th August, 2026
Beanstalk is a simple, easy-to-use job queue system. I had been using NodeJS with the node-beanstalk package to interface with it but it was causing a performance bottleneck so I decided to write my own client. This gave me a 37x speedup in my application!
Read More >
10th June, 2026
To provide an implementation of a mock function you must know its function signature, but whichever one of the overloads you choose, TypeScript will give you an error. The fix is actually quite simple: use the signature of the actual implementation, not the overloads.
Read More >
25th September, 2025
A simple way to draw a triangle, or concentric triangles, in a shader.
Read More >
15th April, 2024
Python’s documentation isn’t entirely clear on what a decorator is or how it works, so here are the details.
Read More >
19th November, 2023
Many languages have the ability to let you create generators: a function that can be called multiple times, picking up where it left off and returning a different value each time. Unfortunately C++ does not give you this functionality, however that doesn’t mean that we can’t implement it ourselves.
Read More >
21st October, 2023
According to the oft-repeated advice of Donald Knuth, “premature optimisation is the root of all evil.” In my opinion this is poor advice. Let me tell you why.
Read More >
26th September, 2023
If you wish to process a very large number of rows from a database then it may be prohibitively expensive to load them all into memory first. Laravel’s chunk() function may look like the solution however this performs a query for each chunk and is therefore extremely slow.
The ideal solution is to disable query buffering and thereby only ever have a single row in memory at once. Note that this option is specific to the MySQL PDO driver.
Read More >
18th September, 2023
The ability to provide a mock implementation of functionality is essential to unit testing, however the method for doing so with Jest and TypeScript is not well documented. This tutorial aims to elucidate the method for mocking a JavaScript library that is loaded into your TypeScript project. This is demonstrated with the ws WebSocket library but applies equally to any library, including built-in NodeJS modules.
Read More >
24th August, 2023
The OpenTelemetry C++ implementation ships with several exporters for outputting your recorded traces: ostream, HTTP, gRPC, and more. It does not, however, provide a null implementation.
A null exporter is useful in test environments, where you just want to discard instrumentation data. The simple class below provides an implementation of a null span exporter.
Read More >
16th August, 2023
Impersonation is a useful tool: it allows an administrator to view the website as if they were logged in as another user, but without having to know their password. The Laravel documentation implies that you can do this using Auth::loginUsingId(), but you will find that this doesn’t work.
Read More >