App Query: when SQL is all you need

I recently found myself working on a fairly extensive data export for a Rails application. My first stab was to take a builder-template, a collection of records and a sprinkle of helper-functions to generate the required XML.

This approach quickly hit its limits: it was hard to get rid of N+1 queries, the performance was abysmal due to both inefficient sql and the sheer volume of AR-instances that were instantiated. And Arel, while a great abstraction otherwise, made it hard to identify the bottlenecks. Meanwhile I had a nagging feeling that "this shouldn't be too hard in raw SQL"...

Continue reading

Published: 2025-12-25

Tagged: 💎 Ruby 🛤️ Rails 📊 SQL

A better regex experience

If you use regular expressions on a, ehm, regular basis, you know it results in code with a short half-life. That carefully crafted string—the one you wrestled into existence through sheer trial and error, tweaking greedy quantifiers here, adding lazy ones there, until it finally worked. In a week or two, it'll be completely opaque. For your teammates, probably sooner. 😬

Continue reading

Published: 2024-02-15

Tagged: ƛ Clojure

Sharp tools: direnv

In this article we'll take a look at direnv, a tool I've been using for years to manage environment variables when developing projects. It recently got new features that especially teams can benefit from.

Continue reading

Published: 2020-10-28

Tagged: env-vars direnv

Archive