One thousand lightbulbs

Gradient background images with ruby and chunky_png

I recently decided that I wanted to make a series of solid colour backgrounds for my laptop. The reasons are nominally grounded in productivity1, but given that the whole exercise sent me down a rabbit-hole of writing code and then this blog post, let’s just call it a little experiment to see what we can do, shall we?

Step 1: Making a solid colour PNG

Our first step will be to create a solid colour PNG of the right size. I’m going to use the ruby gem ChunkyPNG to do all the heavy lifting. Let’s get started!

If at first you don't succeed...

Early last year, I wrote about my 2021 journalling setup - pocket notebook, project journal, page-a-day journal.

And then, late last year, I wrote about how my page-a-day habit fell off. At the end of that post, I mentioned how I thought it was important to let personal obligations go when they become a drag.

Which is why on January 2nd this year I went out and bought another page-a-day journal for this year. OK, I know, this is starting to sound like an abusive relationship, but hear me out.

Ten books I enjoyed this year - 2021 edition

Last year I published a list of ten books that I’d enjoyed over 2020. I quite liked doing it - plus I get to post little book cover images and make the whole thing look pretty - so I’m doing it again!

I like to read widely - which when I say it like that sounds wankier than I mean it. But given an ever-increasing pool of public domain writing, ready access to a public library system that’s embraced ebooks, and a pretty good global second-hand book sale network1, there’s never been an easier time to pick up a book published in the 1850s and really get stuck into it. I mean, think about it - some of the greatest works of English literature are available to you right now either for a pittance, all said, or - if they’re out of copyright - for free.

One of the themes of this year was reading through some of these classics. In fact, of all the books on this list, only two were published this year. There is value in retreading old ground, in re-reading a favourite book and seeing what you think of it now. And there is value in re-visiting something you skipped the first time: now all the hype has died down, was that book just a fad,, or is it also good?

Anyway, enough navel-gazing. Some books:

Building an object model in Vue.js

Over the past six months or so I’ve been learning Vue.js. It’s a real interesting trip - back when I started getting interested in programming Ruby on Rails was the New Hotness™, and I spent a lot of time mucking about with MVC-styled apps and WidgetControllers and the like. Now, some fifteen years later, everything is client-side and javascript!1

Anyway, if there’s one thing harder than getting someone to latch onto an idea, it’s getting someone to let go of it. That’s why, as soon as I got past the “how does it work?” phase of learning Vue, I started building things using ye olde CRUD patterns and object models that look suspiciously like rails’ ActiveRecord.

Don't be beholden to your past self

In January this year I bought a beautiful thick Moleskine page-a-day planner. My goal was to keep a daily log-book, tracking what I did, ate, listened to, read – my impressions as I travelled through the year.

On Sunday, July 25, I recorded a blank day. That’s not to say that I faithfully recorded one entry per day every single day for the period leading up to that day - but at the very least I filled it all out from memory when I did have a spare moment. On Sunday July 25, however, I didn’t bother to go back and fill it out.

Yes-no-and-or

When you reach for the dice in a roleplaying game, it’s normally to answer a question. Normally, that’s a binary question (one that can be answered with “yes” or “no”).

One of the great things about Apocalypse World was the way it employed not just the yes/no axis in task resolution, but the and/but axis1. Each outcome (“yes” or “no”) can be accompanied by either an “and” (making player success more successful, and player failure more complex) or a “but” (moderating the degree of success or failure by introducing a cost or a consolation prize, respectively). In fact, Apocalypse World takes three of these moves: No, and, Yes, but, and Yes, and makes its take resolution system 100% about these (with the ability to get some Yes and in there at the end of your character’s arc).

Proc-gen crosswords from scratch

I like crosswords. After doing enough of them, however, I decided to try to make my own. And given I want to make my own, why not ridiculously over-engineer the whole process with a procedural generation mechanism in ruby?

This is currently a work in progress, but this blog post will at least show you through the start of the crossword building process as it exists right now, and may allow me to springboard off of it onto more complex posts in the future.

Revamping 1klb comments part four: submitting comments

Over the last few posts on this blog(1 2 3) I’ve been introducing my system for collating, storing, and displaying comments on my static site blog using Javascript + HTML for the front-end and FaunaDB for the backend. We’ve gone through the basic outline of the system, set up the database, and talked about how we can fetch and display comments. In this post, I’ll show how you can easily build a comment submission form in HTML, and create a solid, secure comment submission system with server-side functions.

A basic comment form

It’s pretty easy to build a basic comment submission form in html:

Revamping 1klb comments part three: displaying comments

In the previous two posts on this subject I showed off the big picture overview of how this whole system was going to work, and showed you how I set up my database in Fauna to deal with those comments. Assuming that all went according to plan, let’s explore how we actually go from bits in a database, to, yknow, comments on the website.

Two ways of talking to Fauna

I’ve mentioned previously that there’s two ways of talking to the Fauna database: