Turning off the SQL cache in rails background jobs

to improve garbage collection

John Bachir's Code Blog
September 16, 2021

Here's something about memory in Rails background jobs that I sort of encountered over the years but only recently fully figured out. I'll jump straight to the point.

The rails query cache causes ruby to be less effective at garbage collection. This is an acceptable tradeoff in web processes which do not run for a long time . . .

Read More

It's impossible to know what a unique and valuable design looks like before it is built


John Bachir's Code Blog
August 29, 2021

In a discussion recently someone was asking for feedback on how to go about expanding a system to cover more use cases without clumsily breaking the abstraction. I had these thoughts:

Maybe questions to ask are:

  • How easy is this to change later?
  • How easy is this for others to use?
  • Are there any fundamental . . .

Read More

How to create a multi-column full text search index in Postgres

For example, to cover pg_search queries

John Bachir's Code Blog
August 27, 2021

Just a quick post here about something that doesn't seem to be covered much elsewhere.

If you have a query like this (this one generated by pg_search):

FROM "things"
 (SELECT "things"."id" AS pg_search_id,
 to_tsvector('simple',  . . .

Read More

All about fonts on websites!

John Bachir's Code Blog
August 07, 2021

I recently did a big cleanup of how fonts are used on a project. Here's a quick rundown of some things I learned along the way. Each building block is pretty straightforward and easy to find documentation for, but overall best practices, and explanations for how it all comes together, are lacking, so hopefully this guide will fix that . . .

Read More

Running rake tasks from within Ruby on Rails code

John Bachir's Code Blog
July 14, 2021

If you want to run rake tasks from within an already-running rails instance (such as when using ruby-clock) without forking and making a new rails process (system 'rake foo:bar'), it's very possible, but there are a few things to keep in mind.

First, load the jobs once when the app is being initialized (I think this is . . .

Read More

How to create a new column in Postgres with existing rows backfilled with a different value from the default

John Bachir's Code Blog
December 20, 2020

The best approach for creating a new column that has a default has changed since Postgres 11. In the case where we want the existing rows to have a different value from future created rows (e.g. a boolean which signifies if a user should see the onboarding tour), the best approach has also improved significantly in a way that perhaps . . .

Read More

How to figure out what processes are using IO on MacOS / debugging mysterious performance problems

John Bachir's Code Blog
December 06, 2020

This blog post is a loose documentation of some problems I've had with my mac lately and how I maybe diagnosed them, for my own documentation and maybe some of it will prove useful to people who find it when searching.

Lately I've been having mysterious problems on and off with my Mac laptop. Sometimes it almost seems like a . . .

Read More

   Subscribe by email and never miss a post.