Notes

by Matt Stubbs

import_if_available/1 in iex

07 November 2024

IEx provides import_if_available/2 to import a module only if it exists.

So in my .iex.exs:

import_if_available(Ecto.Query)

and there's no error if Ecto.Query doesn't exist.

How to upgrade Heroicons in an existing Phoenix app

29 October 2024

Heroicons are a set of SVG icons stored in assets/vendor/heroicons. They are setup when you run mix phx.new along with a handy UPGRADE.MD file that explains the simple upgrade process:

export HERO_VSN="2.0.16" ; \
  curl -L "https://github.com/tailwindlabs/heroicons/archive/refs/tags/v${HERO_VSN}.tar.gz" | \

Replace the 2.0.16 with the latest version on Heroicons and that should do it.

My project was created before the ‘micro’ size class of icons was created so I needed to add them to tailwind.config.js

plugin(function ({ matchComponents, theme }) {
  let iconsDir = path.join(__dirname, "./vendor/heroicons/optimized");
  let values = {};
  let icons = [
    ["", "/24/outline"],
    ["-solid", "/24/solid"],
    ["-mini", "/20/solid"],
    ["-micro", "/16/solid"], // Added this line
  ];

MightyMoud/sidekick

24 October 2024

Bare metal to production ready in mins; your own fly server on your VPS. - MightyMoud/sidekick

Looks similar to Kamal (listed under inspiration, along with Fly.io).

The docs include sections explaining what each command does:

What does Sidekick do when I run this command

  • Build your docker image locally for linux
  • Compare your latest env file checksum for changes from last time you deployed your application.
  • If your env file has changed, sidekick will re-encrypt it and replace the encrypted.env file on your server.
  • Deploy the new version with zero downtime deploys so you don't miss any traffic.

That's a nice way of explaining what is going under under all the abstraction.

All notes →