Posts

An introduction to hacking on Deno

May 29, 2019

I’ve recently been playing around with Deno - the “secure JavaScript/TypeScript runtime built with V8, Rust, and Tokio”. The reason being is that this lies at the intersection of a couple of my main interests: JavaScript and Rust. I’ve been writing JS professionally now for around 5 years and Rust very unprofessionally for just over a year. Deno was created by Ryan Dahl, the also-creator of Node.js. Ryan introduced Deno to the JS world in a talk titled 10 things I regret about node. ...

Building and using a sys-crate with Rust - let's make a node clone (well kind of...)

August 22, 2018

Rust is an awesome language and platform to use, however there’s so much great software already written in c/c++. Luckily it’s not too complicated to make use of c/c++ projects in Rust. In this short post I’ll show you how. From a high-level perspective you can take any c/c++ project, for this example I’m going to use Duktape, the lightweight embeddable JavaScript engine. I’m choosing Duktape because it’s very simple to build it - it’s just 1 . ...

Ray Tracing: WebAssembly vs JavaScript

August 12, 2018

I’ve spent the last couple of weeks learning about the art and science of Ray Tracing. Ray tracing, for those who aren’t familiar is one technique for generating 3d computer graphics. Ray tracing isn’t the fastest way to generate 3d images but it’s appeal lies in both the realistic effects that can be achieved and in the elegance of simplicity of the technique. This technique is used in movies and for photo-realistic architectural renderings. ...

Supercharge your frontend with Rust 🦀 and Wasm 🚀

July 10, 2018

A quick guide to creating, packaging and using your first WebAssembly module with Rust, wasm-pack and friends… I’m guessing if you’re here you’ve already heard about WebAssembly and you just want to get started building something without reading pages of specification, complex explanations or stewing your brains in binary. If you don’t know what WebAssembly (AKA Wasm) is yet, it’s a new low-level language that can be executed by modern browsers, that traditionally only ran JavaScript. ...

Solving Towers of Hanoi with TLA+

April 4, 2016

Recently I’ve been reading Leslie Lamport’s Specifying Systems book. It’s free to read online, but I bought the hardcopy as I’m old fashioned like that. Ever since I discovered TLA+, I’ve been fascinated with the idea of using precise language to describe systems upfront. Often as developers we either don’t do any upfront specification and just hope to wing it, or we very imprecisely add comments to our code as we go. ...

Using hapi.js with Socket.io

March 3, 2015

Socket.io and hapi.js are two great pieces of software for Node. There’s no official documentation on how they work together though. I’ve seen questions about this several times on Twitter and Github, so I thought I’d write a quick tutorial to show just how easy it is to integrate the two. The listener Every hapi server comes with a listener property: var Hapi = require('hapi'); var server = new Hapi. ...

BSprites: Combined web assets using Typed Arrays and Data URIs

July 28, 2014

Disclaimer: This was a weird idea I had one day and put this together the same evening. I’ve not tested it cross-browser or in a production environment. I’ve not benchmarked this either vs actually downloading all the images. It’s kind of a ‘what if’ project at the moment. If you think it’s really dumb or cool, I’d be really interested to hear your thoughts. Generally, whenever a browser loads a new image, it will make a new HTTP request to the server. ...

Express to Hapi.js

July 23, 2014

This isn’t an X is better than Y post. I love Express, I still think it’s a really great module and I’ve used it successfully in many projects. That being said, I’m hearing good things about Hapi.js (referred to as Hapi from hereon in) recently which is another HTTP server framework for Node.js. So I figured it was time to check it out. As most people who I imagine come to Hapi, I have experience with Express and I’m wondering how it differs. ...

Keeping on top of invoices with the Freshbooks API and Ruby

March 24, 2014

Freshbooks is a great tool as a freelancer, for managing your billing and sending invoices. It is however lacking in a few places for me. One thing I really want to see when I log in is how many days have elapsed since I sent each invoice out. Yes I could work this out from the dates, but I don’t have the time quite often so things start slipping. Luckily there’s an API we can use, and I knocked up this Ruby script in 10 minutes to give me a nicely formatted view of all my active invoices and the days since I created them. ...

Building a complex web component with Facebook's React Library

January 3, 2014

Edit (12-2016): This article has been updated for React 0.14 and ES2015 React looks set to be the hot front end technology of 2014 with some even calling 2014 the Year of React. So I thought I’d introduce it with a tutorial and hopefully learn something myself too. Here’s what we’ll be building: I’m going to show you how to create a complex, interactive web component with React. To this end, I will be creating a 5 band resistance calculator. ...