• The REPL: Issue 124 - December 2024

    Rails is better low code than low code

    Radan Skorić’s points out that the argument for low-code (and even low-code) is that it can get you to your goal faster, and by people that are not experienced programmers. It resonates with me that it can quickly fall apart, once your applications reached a point that is not the platform use case.

    I recently learned about a person I know that used one of those low-code platforms to quickly build an application that could be web-native, and also a native Android and iPhone app. Once the web portion was launched, it quickly got into performance issues, because each page was making hundreds (or even thousands) of AJAX requests to the server. However, he couldn’t really fix the problem, because the platform was not design to deal with the level of data that they wanted. They were stuck.

    Trying out Solid Queue and Mission Control with PostgreSQL

    Andrew Atkinson writes ab out his experience with Solid Queue and Postgres. I’m keeping an eye on Solid Queue, but have not yet made the switch from GoodJob.

    Read on →

  • My Personal GMail Dark Mode

    I switched about a month ago to use dark mode on my Mac and iPhone. It’s been a great experience, except for using GMail on the web. The GMail iOS app has a beutiful dark icon, and a great dark mode UI.

    GMail on the web… does not. Other Google websites (Drive, Calendar, etc) have a working dark mode. I don’t understand why GMail does not.

    I solved it by:

    1. Installing the Userscripts Safari extensions, my current browser of choice.
    2. Adding a custom CSS style:
    /* ==UserStyle==
    @name        Gmail Dark Mode
    @description Quick Hack for Gmail Dark mode
    @match       https://mail.google.com/*
    ==/UserStyle== */
    @media (prefers-color-scheme: dark) {
      html {
        filter: invert(90%) hue-rotate(180deg);
      }
    
      iframe, video, img {
        filter: invert(90%) hue-rotate(-180deg);
      }
    }
    

    Of course, it’s not as polished as the iOS GMail dark UI, but it does the trick!

    Read on →

  • The REPL: Issue 123 - November 2024

    Plugging the Postgres Upgrade Hole

    Upgrading Postgres is hard. I’ve felt the pain, even upgrading local databases. The article outlines why that is the case. Maybe there is some hope for the future.

    What is a Staff Engineer?

    It uses a new-to-me framework for evaluating a job on 4 levels: Core technical skill, product management, project management, and people management. It then talks about what a Staff engineers does in each of these levels.

    How we made a Ruby method 200x faster

    A tale of performance optimization by using a profiler. How to focus on the important parts of a flame graph still seems a bit like a dark art. And not the key point of the article, but the refactor looks really nice!

    Read on →

  • A Rails Migration Foot Gun

    I recently discovered a foot gun when writing rails migrations.

    Rails runs migrations inside a transaction by default, for those databases that support it (e.g. Postgres). It also provides a what to disable it if you so choose, by using disable_ddl_transaction!. That can be useful for example for creating a large index concurrently, which is not supported inside a transaction. It looks like this:

    class FootGun < ActiveRecord::Migration[7.2]
      disable_ddl_transaction!
    
      def change
        create_table :foot_guns
      end
    end
    

    So far, so good. However, because of how disable_ddl_transaction! is implemented, there is also a disable_ddl_transaction method defined. That is an accessor that checks weather the migration should be run in a transaction or not. But it can be used by mistake:

    class FootGun < ActiveRecord::Migration[7.2]
      disable_ddl_transaction # This doesn't do anything!!!
    
      def change
        create_table :foot_guns
      end
    end
    

    The migrations looks like it is disabling the transaction, but it’s actually not. It’ also a hard mistake to catch, because the output rails prints out when running the migration in both cases is the same:

    $ rails db:migrate
    == 20241116193728 FootGun: migrating ==========================================
    -- create_table(:foot_guns)
       -> 0.0137s
    == 20241116193728 FootGun: migrated (0.0158s) =================================
    

    I’d love for disable_ddl_transaction not to exist at all, so that a NameError would be raised, and this mistake was impossible to make.

    Read on →

  • The REPL: Issue 122 - October 2024

    Waiting for PostgreSQL 18 – Add temporal PRIMARY KEY and UNIQUE constraints

    In this article, and a follow up we learn about upcoming changes to Postgres 18 that will make temporal modeling much easier. A welcome change. Maybe soon after that we can get libraries to leverage it in popular web frameworks.

    Rightward assiggment in Ruby

    It’s now possible to use rightward (->) assignment in Ruby. The tweet talks about using it in “pipelines”:

    rand(100)
      .then { _1 * 2 }
      .then { _1 -3 } => value
    
    value # => 7
    

    I am very fond of pipelines like that, but feel that the => is not very visible. What I want to write is:

    rand(100)
      .then { _1 * 2 }
      .then { _1 -3 }
      => value
    

    But that doesn’t work, because the parser balks. I can use a \, but that makes it awkward:

    rand(100)
      .then { _1 * 2 }
      .then { _1 -3 } \
      => value
    
    value # => 87
    

    Goodhart’s Law Isn’t as Useful as You Might Think

    when a measure becomes a target, it ceases to be a good measure

    Long dive into concepts from operations research that go deeper than the pithy “law” and explain the mechanisms at play.

    Read on →