Maybe Functions

The maybe function is a subtle monster that spreads it’s tentacles across the code-base. It’s alternating functionality of “does/doesn’t do something” makes code hard to understand, maintain and debug.

🔗Example

Here’s a specific example, it’s a “maybe” function as it only returns the friends of a user, if the user is logged in. Basically it introduces a possible return null.

function maybeGetUser(): User | null {
if (!loggedIn) {
return null;
}
return fetchUser();
}

Read More

The history of writing tech!

There’s been many recent revolutions in writing technologies, and I thought it would be interesting to compare them and the way they affect the author’s ideas.

We can break down the methods of writing into several technological categories. Each new invention builds on the previous technology, improving writing in different ways.

Read More

Easiest Static Sites on Dokku!

I love dokku but deploying a simple HTML site is actually quite annoying, so I made dokku-pages.

🔗1. Install

npm i -g dokku-pages

🔗2. Deploy Dokku Site

dokku-pages deploy -g dokku@mysite.com:app -d dist --minimal

That’s it!

🔗Optimization

And by using the minimal flag you can also save a tonne of space in your dokku instance.

Deploy Command Dokku Type Image Size
deploy ... Herokuish Build Pack 1.5 GB
deploy ... --minimal Docker Build 22 MB

That’s a saving of 98.5%!

Anyway, hopefully someone else finds this useful.

Reach for the bolt first...

An industrius mechanical engineer is designing a machine and is faced with the problem of attaching a component to another component. What does he do? Well he quickly solves the problem, by selecting several bolts which would hold the two components together… just as he had thousands of times before…

Read More