Weeknotes 107
16th July, 2023
βInternet cafes and dependenciesβ
-
Stick this in your
~/.irbrc
πdef pbcopy(data) IO.popen("pbcopy", "w") { _1.write(data) } end
…say you have a bunch of data in your ruby console and you want to get it to your clipboard. I used to always write it to a file, and then cat the file to pbcopy, but then it occurred to me - ruby can pipe too
-
If you take a single pull request (PR) that adds a new feature, and launch it without tests or documentation, you will definitely get the benefits of that PR sooner.
Every PR you try to write after that, before adding the tests and docs (ie. repaying the debt) will be slower because you risk creating undetected bugs or running into undocumented edge cases.
If you take a long time to pay off the debt, the slowdown in future launches will outweigh the speedup from the first launch.
Worth the read.
-
Credit where it’s due. I reported my broadband issues to my ISP and they sorted the problem within the day. Everything seems much better now.
-
Holy shit! Weeknotes with images.
-
JavaScript dependencies – how does anyone confidently upgrade them? It was my job to bump some packages due to security vulnerabilities this week and trying to do this with any sort of confidence is very difficult.
The sheer amount of dependencies changed when upgrading a package is really scary. What do other people do? Upgrade the world and hope that the tests you have catch any problems?
-
pocket-to-sqlite
is a nice tool from Simon Willison to export the data from your Pocket account into a SQLite database.A couple of teething troubles authenticating, but once I got over those it downloaded everything with ease.
pocket-to-sqlite fetch pocket.db
I’ve been a Pocket user for some time but recently stopped my subscription for various reasons. It started when they rewrote the site as an SPA (why?! π€’) and continued with their unwillingness to fix an issue I had with the web UI in Safari which made it unusable for me (I’ve since moved on from Safari, but come on, Safari is not some unknown browser).
Still, if you wanna export your data into a database, this is the way.
-
I sort of knew so called “Rightward Assignment” was a thing in Ruby, but HashRocket reminded me.
irb(main):001:0> hsh = { a: 1, b: 2, c: 3, d: 4 } => {:a=>1, :b=>2, :c=>3, :d=>4} irb(main):002:0> hsh => { a:, b:, d: new_name } => nil irb(main):003:0> puts [a, b, new_name] 1 2 4 => nil
There are more examples at Ruby Changes.
The syntax is just a bit weird to me. I’ll look for opportunities to use it I guess, but it doesn’t feel intuitive.
-
GitHub merge queue is generally available – this is very nice if you work in an environment with lots of merge activity. I’ve encountered this problem before and the constant tending of branches into production was exhausting so this seems like a great thing.
-
Inside the secret world of NYC’s last internet cafes from The Browser Company.
-
TIL that you can sign git commits with SSH keys. I’ve been signing commits with GPG for years, but it is fiddly to setup.
However, it does sound like GPG still has more features.
Generating a GPG signing key is more involved than generating an SSH key, but GPG has features that SSH does not. A GPG key can expire or be revoked when no longer used. GitHub shows commits that were signed with such a key as “Verified” unless the key was marked as compromised. SSH keys don’t have this capability.
I will stick with GPG I think, but it’s nice to have another option.
-
This week I’ve been writing some background jobs for my side project using Oban. Oban has some really nice testing capabilities built-in. My jobs are fairly basic so far, but the experience has been great. And, most of all, I’m learning new things.
-
git-backdate
– you know, for reasons.git-backdate helps you to change the date of one or multiple commits to a new date or a range of dates.
git backdate origin/main "3 days ago..today" --business-hours
-
Similar to the Object IDs I recently posted about, TypeIDs are a similar idea with Stripe-like resource prefixes and you can use them with Elixir.
user_2x4y6z8a0b1c2d3e4f5g6h7j8k ββββ ββββββββββββββββββββββββββ type uuid suffix (base32)
I can see the benefit of prefixing with the resource type for debugging, sure.
-
The weight loss is going well, but the first week is usually the easiest for me – full of enthusiasm for a new me, and the results are always encouraging from a body that is suddenly in a big calorie deficit.
No graphs yet.