Weeknotes 180
8th December, 2024
“The secret to air travel”
-
Still haven’t set up the new computer. It feels quite disrespectful to leave a new computer sat next to me unused for this long. However, I have started refactoring my Neovim config as part of the move. If that’s not procrastination, I don’t know what is.
I’m making the move to lazy.nvim as my package manager instead of packer. All the cool kids are using it, and it does seem to genuinely allow for the more modular setup I’ve been searching for.
-
Project specific configurations in LazyVim with .lazy.lua – lazy.nvim also has project-level config support. Very useful for working on multiple projects at once.
-
Speaking of Neovim, TJ DeVries is on a great advent run on his YouTube channel at the moment. Some really great content.
-
After quiting the last gym, which I didn’t, like I’ve been just not exercising. Clearly it’s good to exercise, so I’ve been evaluating alternatives for a while.
My original shortlist had on it a gym even closer to me than the last (literally a 3 minute walk) but I discounted it at the time due to the perceived lack of equipment, and strange opening hours. But perfect is the enemy of good, so I decided to sign up for a day pass to see how it really is in practice.
The reality is that the photos on the website are very out-of-date and the breadth of equipment actually really quite good, and it was completely empty. The staff said it is almost always empty, so I’m very hopeful this will mean a return to regular gyming.
-
Sasa Juric has re-written and released the demo from his great talk: The Soul of Erlang and Elixir. The talk is really worth watching.
-
Philips eventually delivered the products I had bought. Awful customer service, see Amazon.
However, the products themselves are great so far. I fitted the Play Gradient Lightstrip to the back of my monitor (which I was hesitant to do, because sticking sticky stuff to the back of such a beautiful display feels bad) and it looks lovely – just what I was after.
At the moment it’s just setup directly via Bluetooth. I’m not sure people are aware you don’t necessarily need the hub. This allows control via the iOS app.
I’ve yet to set up the Hub and Lightstrip Plus I also purchased at the same time, but I’ll get to that soon. Once I have the Hub going that will allow proper automation, and I can use the macOS menubar app, Hue Menu Bar for Philips Hue, I bought to control monitor backlighting via software, and I can also give the Hue Sync app a go to sync the light with the monitor picture.
In my frustration with Philips I had also bought an additional lightstrip direct from Amazon. The point being, I now have too many lightstrips in this house. Soon it will look like the nightmare disco in every room of the Philips adverts.
-
After ordering Philips Hue gear and installing Home Assistant, of course, the next step was to go straight to AliExpress and buy a random variety of ZigBee-enabled gubbins.
I got some temperature and humidy sensors, some temperature and humidity sensors with screens, a human presence detector (!), and most importantly a SMLIGHT SLZB-06M ZigBee co-ordinator to control everything.
I also bought some plugs and a motion sensor from IKEA because cheap and reliable.
Will all this stuff work together? Fuck knows.
I plan to place another order because I am helpless.
-
TIL about
import_if_available
.Useful for attempting to import a module if it is available.
Via IEx “any” Helper.
-
The order I made for a Megadesk was cancelled due to Canada Post being on strike. I’ve set a new reminder, but it seems unlikely that I’ll get one before Christmas now. Sadness.
-
Distributed Erlang – very nice explanation of Erlang in general, but its distribution properties more specifically. I was also impressed with the CSS CRT effect in use, although it made me feel slightly queasy.
-
For as long as I can remember when enqueuing a job in Rails I would always pass an ID into the job. When the job executed at a later time, I would grab the ID, find the relevant model object and the go about my business.
So it shocked me when a code review led to finding out that you can now pass an ActiveRecord object instead of just an ID. This works because of
GlobalID
.Active Job supports GlobalID for parameters. This makes it possible to pass live Active Record objects to your job instead of class/id pairs, which you then have to manually deserialize. Before, jobs would look like this:
This does clean up job code somewhat as you don’t need to do the manual finding the record step. Rails constantly surprises.
https://guides.rubyonrails.org/active_job_basics.html#globalid
-
I wasn’t expecting to hear Apex Twin on the latest series of the The Block. No, not Come to Daddy unfortunately - Avril 14th.
-
Including Rails View Helpers is a concern – This is something I see a lot, and Ruby makes it easy, just mixin all the things. Need one method? Include your friend and mine,
include ApplicationHelper
. -
Missing your Apple Touch Bar?
Flexbar, A More Versatile & Fully Customizable Touch-Bar Solution
How long until someone slams their laptop shut with this inside it?
-
mix test.interactive – An interactive test runner for ExUnit tests.
It allows you to easily switch between running all tests, stale tests, or failed tests. Or, you can run only the tests whose filenames contain a substring.
-
What happens when code reviews aren’t mandatory? An experiment
BridgeCare wanted to try a different approach. While established norms tell us to wait for review before merging, they were like - what if - what if we didn’t require PRs to have sign-off before merging?
We need to remember we once survived without PRs and without PR reviews.
Building trust with teammates through communication and consensus-building about key/structural updates is essential
Oh. Never mind.
-
The dangers of the Single Global Process – An interesting article on the dangers of using a single global process in your Elixir app.
-
This is more of a TIL type post, I should start that TIL site I spoke about in 2021. Anyway, Elixir processes…
Each Elixir process has a mailbox for messages. When a process is sent a message, it is stored in the mailbox until it is processed. Processing happens using a
receive
block, or we can flush the messages.You can see the messages a process has using
:erlang.process_info
.iex(1)> :erlang.process_info(self(), :messages) {:messages, []}
self()
returns the PID (Process Identifier) of the currently running process, in this caseiex
.Send a message to the process.
iex(2)> send(self(), {:foo, "bar"}) {:foo, "bar"}
Now the process has a message in it’s mailbox.
iex(3)> :erlang.process_info(self(), :messages) {:messages, [foo: "bar"]}
Flush the messages.
iex(4)> flush() {:foo, "bar"} :ok
Bang and the message is gone.
iex(5)> :erlang.process_info(self(), :messages) {:messages, []}
-
ZigBee and Wi-Fi Coexistence – useful for my current house project. Given that ZigBee and Wi-Fi share space in the radio spectrum it’s worth being aware which frequencies can interfere with each other.
-
Got a real Christmas tree this year? Do yourself a favour and get down the Middle of Lidl and buy a Weihnachtsbaumständer for the bargain price of £14.99. This thing is incredible.