Starlight Dawn

August 28, 2023

I’ve been working on an in-browser interactive fiction/game for the last few years that I have finally decided is complete: Starlight Dawn. It’s a tile-based RPG in the vein of the old Ultima games. It was made with Ruby and JavaScript. You can play it right now, and your location is saved in your browser’s local storage. There’s no sign up or other requirement. Just start playing! You can also follow on Mastodon.

Screenshot of the experience showing an animal on a short next to a sign.
There is a boat in the ocean and mountains past the shore. A person is waiving next to a town
A picture of what the experience looks like. Click to embiggen.

Getting 'Save to Home Screen' to Kinda Work on iOS

August 24, 2023

iOS has a feature on any website called “Save to Home Screen”, which creates an icon that then goes to that site. If you craft your website a certain way, this will launch the site in an app-like mode that is often referred to as a “Progressive Web App” or PWA. iOS does not support many features of PWAs that are available on Android or ChromeOS, but it supports some. This post will document exactly what you need to do, because it’s not documented very well.

Ruby on Rails Background Jobs with Sidekiq Beta

July 12, 2023

My first Rails job involved a lot of background jobs, and the year and a half I worked at LivingSocial was, in many ways, a crucible of managing background jobs. Today, the book I wish I had been given at the time is now in Beta: “Ruby on Rails Background Jobs with Sidekiq”.

The book is tightly focused at under 70 pages. It’s a pragmatic guide to using Sidekiq background jobs to make your app manageable without notification fatigue. Putting code in a background job is almost trivial—making it fault tolerant, idempotent, and self-healing is the hard part, and it requires care when designing your app’s features.

This book is all about that.

My Toolchain for Building Programming Books

February 03, 2023

This is a bit of a long post describe the custom toolchain I created—and philosophy behind it—for the books that I’ve self-published. It was created to solve a problem that plagues technical books: keep them updated as libraries and programming environments change. My current solution completely automates all code samples, command-line invocations, screenshots, and many of the diagrams.

Dealing with Flaky Tests

November 29, 2022

Jason Swett asked on Twitter if anyone has an app with 2000+ tests that does not have a severe flaky test problem. I have two such apps, and I want to share the lengths I’ve gone to to make the tests not flaky.

In a nutshell, you have to build and design for testability at all levels, plus ensure your tests are clear about what is the cause of a failure.

An Alternative View on Avdi's Barewords Video

November 21, 2022

Avdi Grimm has created great videos about Ruby called Ruby Tapas, and put up an older one as a video for his new Graceful Dev offering. The video is called Barewords in Ruby and it’s a good demonstration how to make changes to a system without changing a core piece of logic.

While I like how Avdi approaches it, I’d make different trade-offs and make changes that result in code with behavior more easy to predict than code that requires fewer changes. Let’s see.

Your Rails and Ruby Versioning and Gemfile Policy

November 17, 2022

One of the lowest-effort, highest-value practices you can adopt for sustainable development is to keep your dependencies updates frequently. The foundation for doing so is to have a clear and reasonable versioning policy. This post includes one for Rails apps that I have used for years and has served me and my co-workers well. It has some implications for specific procedures you will adopt as well.

In a nutshell: stay no more than 2 minor versions behind Ruby and Rails, and keep everything else as up to date as you can as often as you can.

RSpec Examples are, well, Examples

November 09, 2022

RSpec’s internal DSL allows creating some difficult-to-sustain structures and code, but there is one guiding principle that has helped me avoid making tests that are too weird:

RSpec tests should be examples of how the code under test would be used.

Let’s see a few examples: using subject and avoiding predicate matchers.

Wrap Third Party APIs in Service Wrappers to Simplify Your Code

October 31, 2022

The app I work on has a lot of API integrations. These API calls are often tied into various business processes. By wrapping an adapter around each API, presenting only the features of that API my app needs, I can more easily manage and test my app. It also provides clear documentation about how my app uses each API. I’ve heard this called a service wrapper and it’s incredibly useful.