Weeknotes 181
15th December, 2024
“Proc composition”
-
Friends visited for a Christmas get together which was delightful because I wasn’t expecting it and I really appreciate the effort of driving 5 or 6 hours. This did however lead to being uncomfortably full due to the sheer amount of beige consumed.
-
During the move to lazy.nvim I discovered Neovim has
set wrap
on by default. Who are these monsters who want word wrap turned on by default? -
This week I was reminded of Proc composition in Ruby.
This is so cool. Check this.
>> strip = proc(&:strip) #<Proc:0x000000014dc3b830(&:strip) (lambda)> >> downcase = proc(&:downcase) #<Proc:0x000000016e0746e8(&:downcase) (lambda)> >> remove_alias = proc { _1.gsub(/\+.*@/, '@') } #<Proc:0x000000016dcfbed0 (starfish):14> >> email = " Test+alias@example.com " " Test+alias@example.com " >> (strip >> downcase >> remove_alias).call(email) "test@example.com"
I followed this until I got to the
(strip >> downcase >> remove_alias)
part. I’ve never seen>>
used in this context so I was confused. This is apparently the proc composition operatorReturns a proc that is the composition of this proc and the given g. The returned proc takes a variable number of arguments, calls this proc with them then calls g with the result.
More details about Proc composition over on Ruby Changes.
-
Rails’
ActiveSupport::StringInquirer
is cool.>> x = ActiveSupport::StringInquirer.new("bluesky") "bluesky" >> x.bluesky? true >> x.foobar? false
https://bsky.app/profile/jamie.schembri.me/post/3lcil7i4ay22c
-
My audiobook listening hasn’t been going well. Mainly because I have so many podcasts to keep up with that poor Lord of the Rings is getting pushed back farther and farther each day. However, it has not been helped by Prologue randomly losing the place in the book and resetting my listening position back to the start. Good times.
Can I be bothered to try and scrub through the back to the position I left it last? I’m not that far in, so it might not be too terrible, but will it happen again?
-
Nice overview of the new features in Elixir 1.18.
-
Syntax code highlighting is something that I’ve been meaning to enable on my weeknotes for ages, and this week I finally got to it. Check it 👇
class Foo def bar "and I'm Ruby!" end end
I went through all previous weeknotes and made sure all the code snippets have the correct language specified too.
I’m good to you.
-
I also added Next/Previous links at the bottom of each blog post – crikey!
-
add vim.lsp.config and vim.lsp.enable – this seems great to me. I’ve seen some detractors, but I haven’t fully embraced LSPs because of the overhead involved in setting it all up.
Not all Neovim users have the time or inclination to try and figure out how to mould the various Lua you need into something that works. If these new APIs can help me set up an LSP more easily, I’m all for it.
-
How some of the world’s most brilliant computer scientists got password policies so wrong
-
We’re gradually making this house look more homely, this week by acquiring a mirror from Facebook Marketplace and hanging said mirror. Drilling two holes in a wall was harder than necessary, but such is DIY. I hope it stays on the wall! Really pleased with it though.
-
Module names in Elixir are actually Atoms underneath.
iex(1)> Game.DynamicSupervisor == :"Elixir.Game.DynamicSupervisor" true
Elixir converts all module names to Atoms prefixed with
Elixir.
. -
I was talking to someone about needing to do a rename in a large Rails project this week, and it’s requiring a lot of small, gradual, changes. In other runtimes/languages this would be a right-click, rename, deploy.
Ruby is great, but everything is a trade-off, and I think we should be honest with ourselves when it sucks.
-
AliExpress happened again. Retail therapy occurring in the form of a POWKIDDY v10 handheld console ala GameBoy which I’m sure I will play and charge at least once.
-
Car goes into the garage tomorrow. Wish me luck!