Weeknotes 125
19th November, 2023
“Collaborator”
-
We made an error with the 2023.42 OTA update - a fat finger where the wrong build with the wrong security certificates was sent out.
Awks 🫢
-
The Cows Are Mad – I really enjoyed this terrifying story of “Mad cow disease”. I remember it at the time, but didn’t really realise how scary it was/is until much later.
Science has still failed to definitively answer two major questions about mad cow disease - where did it come from and how did humans get it?
-
The Katz Conjecture: You Must Understand What an Abstraction Abstracts by David Bryant Copeland
These examples of leaky abstractions are really good. I’ve found it hard to put into words what a leaky abstraction is.
However, if you are really writing a reporting system with a ton of complicated joins across many tables, an ORM like Active Record might make things worse. Complicated queries in Active Record are often more complicated than the SQL you’d need to run. But you wouldn’t know that if you don’t know how to solve the problem with SQL.
I’ve found myself writing a query by hand and then having to shoehorn it back into an ActiveRecord many times.
-
Twenty Years of Ruby in Five Minutes – this was my favourite talk at Brighton Ruby 2023. The lightning talks are almost always the best.
-
OKLCH for better color in the browser.
TIL about the
oklch
colorspace coming to a web browser near you soon. Evil Martians have a great blog post that goes into loads of detail about this new way of specifying colors, most of which went over my head. But one thing is obvious – the colours just look nicer. -
TraceLocation looks very neat for exploring unfamiliar Ruby code.
TraceLocation helps you trace the source location to ease reading huge open-source libraries in Ruby.
Via Lucian Ghinda.
-
I knew we don’t get enough Vitamin D during the Winter in the UK, but I didn’t realise that it was for so long.
But between October and early March we do not make enough vitamin D from sunlight
I used to take a supplement, but like other healthy life behaviours, I stopped. I’ve ordered some more and will start taking them ASAP.
Stupid angle of the sun 🌞
-
Making a note of sqlfluff should I need it one day.
A modular SQL linter and auto-formatter with support for multiple dialects and templated code.
-
I watched another of Andrew Courter’s videos, this time Autocommands in Neovim. As a result I’ve added this autocommand to my config which highlights on yank showing you what was yanked visually.
-- Autocommands vim.api.nvim_create_augroup("custom_buffer", { clear = true }) -- Highlight yanks vim.api.nvim_create_autocmd("TextYankPost", { group = "custom_buffer", pattern = "*", callback = function() vim.highlight.on_yank { timeout = 200 } end })
I’m going to trial it for a bit.
-
I wrote my first Elixir macro last week (I forgot to say).
defmodule Foo.DocsHelper do defmacro __using__(_) do quote do def docs() do fetch_docs() |> render_markdown() end defp fetch_docs() do module = unquote(__CALLER__.module) docs = Code.fetch_docs(module) case docs do {_, _, _, _, %{"en" => moduledoc}, _, _} -> moduledoc _ -> nil end end defp render_markdown(nil), do: nil defp render_markdown(moduledoc) do moduledoc |> String.trim() |> Earmark.as_html!() |> Phoenix.HTML.raw() end end end end
Turns out that I didn’t need it in the end, but I still think it’s cool.
You can
use
the module and it will add adocs/0
function to your LiveView which reads the documentation from your@moduledoc
and renders it as Markdown.defmodule FooWeb.BarLive do @moduledoc """ I am documentation """ use Foo.DocsHelper def render(assigns) do ~H""" <p> <%= docs() %> </p> """ end end
Neat!
-
Validating Data in Elixir: Using Ecto and NimbleOptions is a good introduction to NimbleOptions, which I hadn’t heard of before.
-
YJIT Is the Most Memory-Efficient Ruby JIT
The YJIT team has spent a significant amount of effort optimizing YJIT so that it doesn’t just show good peak performance numbers, but also does this while being memory-efficient. This effort has paid off, with YJIT having the least memory overhead of any Ruby JIT, which has been crucial in enabling YJIT to handle Shopify’s SFR deployment.
Impressive work on YJIT.
-
“I built a trading bot that buys stocks that are being bought by politicians”
It is up 20% since it launched in May 2022. The market has been flat during the same time period.
😠
-
We went to see Daniel Kitson’s new show, Collaborator this week. One of the most anxiety-inducing hours of my life. He handed out scripts to everyone, some speaking parts, some not. And then everyone put on a play! Thankfully, you didn’t have to take part. It was amazing good!
-
Reorient GitHub Pull Requests Around Changesets – some great points here!