TWIL August 29th 2025
- I already knew this, but overwriting Rails' default accessors for model attributes is a bad idea. So many different things can go wrong.
- If you need an extra argument in your setter on an AR model, you can just redefine the setter and add it in
- I added a separate
update_with_extra_attributemethod, but might explore whether I can just use the setter itself tomorrow - Defining the separate method lead me to learn about public_send though
- Since I needed a way to call the setter with an extra argument (
attr = value, extra_argpredictably did not work)
- I added a separate
- Institutional knowledge is a huge advantage, my skip-level was casually answering/asking questions in our incident retro today which would've taken me hours of trawling code across different repos to come up with
Links
Obsessing Over Smooth radial-gradient() Disc Edges - Ana Tudor
As it happens I used radial gradients on a background at work just before reading this, so bookmarking it in case design complains about jagged borders. I found it interesting it's even necessary to go through all the effort the article mentions to fix jagged gradient borders, seems like something the browser should take care of automatically.
5 Useful CSS functions using the new @function rule - Una Kravets
They're Chrome-only so far, but CSS functions look really handy for DRYing up CSS. The first example is the article, automatically negating values, is something I was repeatedly annoyed by earlier today (mostly because I forgot units matter). Functions can even encapsulate media queries, which seems like it'll be really useful.
Big O - Sam Who
A handy explainer for everyone's favourite notation to obsess over when interviewing then nearly forget about once you actually have a job. It's useful stuff, but every time I need to write the Big O of an option in an RFC I forget the details. This is a nice reminder of those, and much friendlier than the Wikipedia page I usually end up on. One thing I always forget is to drop the 2 in O(2n) for example, my brain just does not accept that it's not relevant.
Reservoir Sampling - Sam Who
Another great one from some, this time about ensuring fair sampling when you don't know how many items there are in advance. Sampling has been the source of a few points of confusion for me when looking at our logs in the past and I've found that visual aids, especially interactive ones as used here, make a big different to understanding. Worth a read even if you don't use sampling just to be surprised by how simple the solution to a seemingly complex problem is.
Hyvector
Handy browser-based vector editor which is simultaneously much less intimidating that the one I used in the past and definitely allows multiple paths (something I'm still not sure the previous one can do).
Very Early Playing with random() in CSS - Chris Coyier
random() looks like it'll enable a lot of cool stuff when it lands everywhere, from animations to generated backgrounds that're different on every reload. Chris' article goes over some of the basics and extra details of the spec.
Pixelspace Solar System
Occasional reminders of how insignificant we are are good to maintain perspective. I especially like the lightspeed button, and how incredibly slow it is at that scale.