RSSAmplifier

Blog

jhollinger

Code et all

jordanhollinger.comRSS feed ↗10 posts

Latest posts

I love designing extension APIs

At a previous job where I did 50/50 front-end/back-end work, we had to be HIPAA compliant. We also needed to support “offline mode” in the browser. This involved downloading data during sign in, fetching encryption keys from the backend, encrypting the data before writing it to browser storage, decrypting the data on-demand, and ensuring the encryption keys weren’t readily accessible after a…

My feud with Philip Glass

Philip Glass is a well-known late-20th century American composer and pianist. I personally enjoy some of his work (e.g. Mad Rush ). Other pieces are interesting but… less accessible . I have my father to thank for introducing me to his music, as well as many other classical and contemporary composers. But I have no direct connection to Mr. Glass. A few years ago Geico suddenly began addressing me…

Am I about to be arrested?

It’s Thursday. As is my custom, I’m working on my laptop out of a coffee shop in downtown Lexington. My mind deep in some code I’m rather proud of, I hit Ignore on an incoming local call flagged as potential spam. (That describes most of my calls.) They immediately call back. That’s new. Well, the warning has been wrong before. I answer. I’m greeted by the Fayette County Sheriff’s Department. Am I…

Uberloader

After years of working on OccamsRecord and wondering if and how any of it could be ported to Rails/ActiveRecord, I finally made the first step: Uberloader . Uberloader is an “extension” (read: shameful monkeypatch) to ActiveRecord enabling you to customize the SQL of preloaded associations. Add a WHERE condition, ORDER BY , etc. Example widgets = Widget .where(category_id: category_ids)…

Custom Preloader Scopes in Rails

This post is really just a quick reminder for myself any time I need to use ActiveRecord::Associations::Preloader to customize the scope of a preload. It’s a private API, so it changes a lot. Really need to write a gem that does this gracefully… Rails 7.1 ActiveRecord::Associations::Preloader. new( records: companies, associations: :projects, scope: Project.where(foo: "bar"), ). call

Rubyzip and Tempfile

Recently I was working on a project involving rubyzip . There was a Queue of incoming Tempfiles from several threads, and my code in the main thread was happily adding them to the zipfile. Nothing terribly strange. Except…about 10% of the time I’d get an Errno::ENOENT from rubyzip (i.e. it couldn’t find the file). queue, num_threads = spawn_threads num_dead = 0 while num_dead < num_threads if…

Using Rails strict_loading in production

Null references are sometimes called programming’s “billion dollar mistake”, due to the countless hours spent hunting down and fixing null-related bugs. I like to think that in an alternate universe, null wasn’t introduced and everyone is much happier. The N+1 query problem If Rails has a billion dollar mistake, it’s ActiveRecord’s lazy loading of associations. When this happens in a loop, it’s…

Release Candidate Male

Alpha Male Missing functionality Lots of bugs Unstable, may crash unexpectedly Not suitable for general use Beta Male Feature complete Still kinda buggy Useful as a preview Release Candidate Male Minor bugs Open to feedback and improvements Has had extensive therapy user-testing Suitable for most use-cases GA Male Will let you know if I meet one

Testing OccamsRecord

I like to pitch OccamsRecord as “the power tools ActiveRecord forgot”. It’s been rewarding both to build and use. A few other people/companies have used it, and that always blows my mind. But this article isn’t about using a very cool library I wrote; it’s about testing it. TL;DR we’ll be talking about appraisal , Docker Compose, and bash scripting. Don’t worry, I have unit tests! OccamsRecord ’s…

Simplicity

KISS (Keep It Simple, Stupid!). Do the simplest thing that works. Occam’s Razor. If you’ve been writing software for many years you might be familiar with the desire for simplicity in code and system architecture. Personally, I didn’t start out with a specific appreciation for simplicity. My journey was something like: Look, my code works! Look how clever this code is! Never mind, look how…