Will Hackett


Read this first

For the love of Promises, stop nesting your chains.then()

I’ve been spending a lot of time in some express JS applications lately. I love express, but generally only when I can work with ES7 syntax.

However, lately I’ve been tackling deep, nested, unreadable promise chains.

app.use((req, res) => {
  runSomeDatabaseCode().then((response) => {
    const newResponse = response.manipulate();
    runSomeAPICode(newResponse).then((data) => {
      if (!data) throw new Error("It Broke");
    }).catch(err => res(500).send('Error'))
  }).catch(err => res(500).send('Error'))

For the love of all things asynchronous, please tidy this up. The solution in this instance is quite simple — linear promise chains.

app.use((req, res) => {
  new Promise(r => r()) // Just an empty promise to start the structure
  .then(() => new Promise((resolve, reject) => {
    .then(response => {

Continue reading →

SMTP—A private mailbox

My Inbox Is overwhelmed.

I receive all matter of spam—old email subscriptions, fake bank notices and emails from my many foreign wives requesting I provide money for a visa. It’s a nightmare.

I’ve devised a few simples changes to SMTP to improve the email experience and bring it on-par with messaging applications like Facebook Messenger, WhatsApp, Telegram, etc.

Mailbox Configuration

The typical mailbox configuration serves well for sorting of most messages received to your account—leaving the inbox as a wasteland for any unfiltered messages.

Personally, I have a mailbox for my Finances, Bug Reports, Clients and Important. Most of my emails filter through to these places automatically, which nicely keeps most of my inbox clean. But, signing up to services and general abusive spam messages are creating a culture of the inbox being a fairly unimportant place.

In the past, you’d have...

Continue reading →

Encrypting user credentials, session & recovery data for better application security

Log-ons used to be simple — type in a username and password, match it against a database and generate a session.

This common logon method is used in WordPress blogs, countless web applications and has practically become standard because of its ease of use.

Key loggers, prying eyes and poor password choices have created a culture of two-factor authentication by requirement. It’s simply too easy to break into accounts that use just an ID and password as credentials.

In light of this future, I recommend following a strict set of guidelines that can be implemented into your applications at any time.

These concepts work at scale and with stateless client applications.

The General Problem

PII (Personally Identifiable Information) is easily matched to a user’s credentials. An ID of the user’s profile, email address, date of birth and other sensitive information that is primarily used to...

Continue reading →

Imagining software in a mesh-networked, potentially-disconnected future.


We’re living in an increasingly connected world. Phones synchronise our photo libraries to our cloud provider of choice. Content distribution networks handle edge caching to help us stream our favourite television shows. A message can be sent, encrypted, from one end of the globe to the other in milliseconds. Cars can share data collected from drives to improve machine learning.

Each of these functions is achieved with software on the device and software in the cloud. Client side and server side. Customer and business. This approach to software development enables a user to keep their data safe elsewhere, but also creates a user-reliance on the cloud provider to have this copy available when things go awry, or in Google’s case - to access anything.

There are two distinct approaches to developing applications—demonstrated by Apple and Google, respectively.

Google’s approach involves...

Continue reading →

Using Web Workers to run JavaScript in parallel

JavaScript, in the browser, runs in a single thread. This is fine, and works fairly well for most websites. However, when running large, complex tasks or long scripts, it makes the webpage unresponsive.

The best way to speed up these tasks is by running code in separate threads. This has been doable for some time, using ArrayBuffers, but it has considerable memory overhead.

An experimental feature, SharedArrayBuffer, provides a way to effectively share data, using Atomics, between threads.

How do we achieve this?

Web Workers provide a way to run code in seperate threads. These threads can run parallel to other threads, and ensure that our page doesn’t freeze up while processing.

The downfall of Web Workers is that they can’t access the DOM or variables in the main thread, but it can make XHR requests.

This means that we need to somehow communicate results of the worker threads back...

Continue reading →

Log & Arrow

I’ve released a node module to solve the simplest, edgiest of cases that really bugs me during development.

Let’s say you have a case:

const someFunction = variable => ({

Debugging at this point is a little bit annoying because you’d have to pull apart the arrow function and return the object manually with a breakpoint in front. Additionally, you can’t just wrap the return in a console.log because it won’t return the original value.

Enter logandarrow.

const someFunction = variable => la()({

Looks pretty simple - hey. Log & Arrow sits directly before the return of your arrow function and produces the same output as usual, but offers a console.log output prior to the return.

You can also make use of log, error and trace functions with a prefix using a nice little constructor.

import { debug } from 'logandarrow';

Continue reading →

An explanation of Amazon’s recent S3 outage

Amazon Web Services office
Amazon Web Services recently experienced a three-hour long outage within its simple storage service (S3) offering. The outage only lasted a few hours, but had massive ramifications for dozens of sites hosted in the US-EAST-1 (Virginia) region.

The company has explained that they were attempting to debug an issue causing S3’s billing system to run slowly. At 9:37 AM PST (4:30 AM Wednesday AEST), one of the technicians ran a command intended to remove some servers geared to supporting the S3 billing process. However, the technician entered an incorrect input for the command which resulted in a larger number of servers being removed — including servers required for indexing, metadata and location information of S3 objects in the US-EAST-1 (N. Virginia) region. As a result, AWS S3 couldn’t process any HTTP requests in the region.

A placement subsystem is used during PUT requests to...

Continue reading →

Mastering the Inbox

I’ve come to a point where I’m absolutely stressed out about the crazy situation that I manage to put myself into with my inbox.

I have thousands of newsletters, product updates, promotions, and spam just laying amongst emails from colleagues, landlords, family, banks, etc.

With promotional and unsolicited mail mixing with important mail in my inbox, it’s hard to resist just deleting everything and starting fresh.

Look for an email client that makes task-based inbox easier.


By following two rules, I’ve managed to reduce inbox stress:

  1. Treat everything in the inbox like a task.
  2. Only check your inbox twice per day.

To do this, you’ll need to look for an email client that makes task-based inbox easier. I’m using Polymail because it has a bunch of nice features alongside gestures to speed up making things as done or to notify me later.

I spent a good two hours working through the...

Continue reading →

Another post by somebody who left a popular blogging platform

Gosh. Shock horror. I left Medium.com.

I guess, it was an easy decision after they stopped their custom domain approval process for a “short review”.

Psst! Still waiting, guys!

I’ve been eager to find something better, so I’ve decided to give Svtble a go. On first look, they haven’t the foggiest idea how to spell subtle, but boy do they sure know how to pull off subtle.

The editor uses Markdown, which is a nice change from Medium’s rich text monolith. This keeps my posts simple, and my editing lag and distraction free.

If I’m going to complain about anything, it’s the lack of space for author pages. I’d like this to replace my website, but unfortunately it may need to live at a subdomain—I’m undecided.

I’ve migrated only some of my better blog posts across to Svbtle with the intention of writing more as I go along.

Continue reading →

JavaScript—async vs defer

My attempt at being helpful—it’s annoying I have to explain this.

There has been a mild amount of confusion regarding how Async and Defer work when including scripts. This is kind of necessary if you have rather chunky scripts, or scripts that you want only to run after the DOM has finished rendering.


Rendering is the parsing of HTML—this makes up the DOM. JS downloading is the script downloading to the browser, and JS execution is when the script is executed. This is a fairly standard timeline in all browsers, and you can visualise it using most browser’s developer tools to see what’s holding up page-load time.

Traditional <script> tags

Without any attributes, the browser will wait until the file has downloaded before it continues parsing the rest of the page. This means, if you have JS nested in the head of your page, it will wait for it to download and complete before it...

Continue reading →