Adventures With Base-64

This’ll be a quick one, I promise. Recently a friend was looking at generating random-but-unique URL identifiers for a web project, and I immediately thought about this awesome video by Tom Scott about how YouTube encodes its IDs for URLs. (If you haven’t seen the video, or any of Tom Scott’s videos, I highly recommend them.) Rewatching the video, I was like ohhhh, base-64 encoding, I know how that works…. wait a minute.

Read More…

One-keystroke Unicode characters in QMK on macOS

Written using QMK 0.6.0 on macOS High Sierra 10.13.3

I recently picked up an ErgoDox EZ keyboard, and was excited to add some Unicode characters to it. Some may know that I dabble with Esperanto, so I wanted the ability to type characters like ŝ and ŭ with a single shortcut. Plus, ✨ emoji ✨! I know macOS has an emoji picker with Cmd + Ctrl + Space, but that’s kinda painful to do repeatedly.

Read More…

How I Work: Tackling Advent of Code, Day 21

For the past three years, the amazing Eric Wastl has been running the Advent of Code - programming puzzles in the format of an advent calendar, a new puzzle every day for the month of December. They’re mindbending but great fun!

I wondered if people might be curious how I attack these kinds of puzzles - and by the reaction I got on Twitter, I guess the answer is yes! So here goes - this is day 21, the most recent puzzle I’ve completed in the 2017 edition.

Read More…

The Noobs Guide to Programming a Vortex Core

Recently I’ve formed a bit of an unhealthy obsession with mechanical keyboards, and one of the first boards I’ve picked up is the infamous Vortex Core.

Read More…

Rails 4 in Action... now for Rails 5! Chapter 2

Continuing on from the chapter 1 runthrough of Rails 4 in Action updated for Rails 5, today I’ll cover the testing frameworks that we originally covered in chapter 2. Testing will once again save our bacon!

Read More…

Rails 4 in Action... now for Rails 5! Chapter 1

Lots of people have asked me, since the release of Rails 5, a couple of things:

1. Will there ever be a Rails 5 in Action? (if there is, I won’t be writing it)

and, more importantly:

2. Can Rails 4 in Action be read and used with Rails 5?

So far my response has been “it likely can, with a few gem version bumps” but I haven’t known the answer for sure. Time to find out, chapter by chapter, line of code by line of code! Let’s dig in.

Read More…

When Rubygems gem versioning goes bad

Rubygems, the package manager for Ruby, has long had this neat little functionality to let you specify the version of a gem you want to use, when running a gem-related command. If you have two versions of Rails installed, say versions 4.2.8 and 5.0.2, you can specify which to use by prefixing the command with a specially-formatted version number.

Read More…

The awesomeness of sass-autocompile

Sometimes there’s a real urge to overcomplicate tech situations. When looking at converting my blog from Jekyll to Hugo (which I’ll write a whole separate post about, soon!), one of the big listed weaknesses of Hugo is no concept of an asset pipeline - nothing to preprocess and compile stylesheets, JavaScript files, etc.

Read More…

TIL: Ecto reading after writes

Today I learned that by default, Ecto doesn’t read data back from the database, after writing new or updated data.

The scenario: A trigger in the database, that calculates the new value of a field before insert or update. The person who presented this problem was quite convinced that the trigger wasn’t running in their tests, based on code like the following:

Read More…

A Whirlwind Guide to Esperanto

So after I wrote my last post, I heard from several people that they’d vaguely heard of this Esperanto thing, didn’t know anything about it, could I please tell them a little more? Absolutely! Enjoy!

Note: Some of this may be somewhat factually inaccurate, as I am only a komencanto (beginner) and working off about six months casual learning.

Read More…