Matthew Lindfield Seager

The excitement (and nervousness) are building for my first ever conference talk!…

More holiday reading down the coast: Deadly Cross by James Patterson πŸ“š

Finished reading: 23rd Midnight by Maxine Paetro and James Patterson πŸ“š

Underwhelming story and writing, never really felt immersed or invested πŸ€·β€β™‚οΈ

Very excited (and nervous) to be accepted as a speaker at RubyConf Thailand in October πŸ₯³

If all goes to plan I’ll be implementing a HTCPCP server live on stage.

Looking forward to listening to the keynote speakers!

Thoroughly enjoyed reading Joanna Jenkins’ debut novel, How to Kill a Client πŸ“š

I had the killer figured out early on and was patting myself on the back, right up until the final chapters proved me wrong.

Found A Game of Thrones by George R. R. Martin on the bookshelves of our holiday rental. Good story but much grittier than what I normally read πŸ“š

More holiday reading: The Girl in the Castle by Emily Raymond and James Patterson πŸ“š

By the by, I’d love to know more about how these books written by both a famous author and a lesser known author work πŸ€” First saw it a long time ago with Tom Clancy but it seems to be happening more and more lately.

Finished reading In The Blink of An Eye by Jo Callaghan πŸ“š

The plot seemed a little too coincidental at times but the author’s real life experiences and emotions were well captured in the lead character. Glad I read it!

Finished re-reading The Sentinel by Andrew Child and Lee Child πŸ“š Enjoyable but not memorable in any way. Going to try a new author with my next book

Just finished some light holiday reading in Sweden, No Plan B by Lee Child and Andrew Child πŸ“š

Just read Recursion by Blake Crouch after seeing it mentioned by Manton πŸ“š

Clever premise and reasonably well-paced.

Finished reading: The Bullet That Missed by Richard Osman πŸ“š

Finished reading: The Man Who Died Twice by Richard Osman πŸ“š

Finished reading: The Thursday Murder Club by Richard Osman πŸ“š

Finished reading: Rhythm of War Part Two by Brandon Sanderson πŸ“š

Finished reading: Rhythm of War Part One by Brandon Sanderson πŸ“š

Caught the moon and a star smiling and winking at me last night πŸ˜‰

Adding a banner to staging site using JavaScript

I wanted to put a banner on the test/staging copy of our library management system to make it easier for the librarian to know which system he is using.

Here’s how I added a red ribbon to the top corner, an idea I stole from RailsGuides, using JavaScript:

var div = document.createElement("div"); = "fixed"; = "0"; = "0"; = "100"; = "white"; = "30px"; = "rotate(45deg) translate(27.5%, -40%)"; = "200px"; = "bold"; = "italic"; = "0px 2px 2px 1px #1209096e"; = "2px 2px 4px #5400007d"; = "radial-gradient(circle, rgb(255, 10, 0) 0%, rgb(200, 0, 0) 90%)"; = "center";
div.innerHTML = "TEST";

Finished reading: Dawnshard by Brandon Sanderson πŸ“š

Finished reading: Oathbringer Part Two by Brandon Sanderson πŸ“š

Today I learned that Cloudflare has a free alternative to ngrok, Cloudflare Tunnel

Can use it without logging in on their domain or set it up with named destinations at own domain

Just finished Oathbringer Part One by Brandon Sanderson πŸ“š Might have to wait a few weeks until holidays to read part two… and the rest of the series.

Finished reading Edgedancer by Brandon Sanderson πŸ“š

Icon Set from a single image in 15 seconds

I built some AppleScript applets to launch Gmail to a specific account and Brave to a specific Profile (could also be done with Chrome) but I didn’t like the generic “Script” icon.

Screenshot of dock icons showing the ugly default script icon between two snazzy custom icons

At first I just pasted my custom image into the “Get Info” window to update the icon but then when I made changes to the app and re-saved it, the icon got reset. I wanted to permanently updated the “applet.icns” file in the bundle but I didn’t want to spend an hour fiddling around with all the icon sizes.

Turns out, creating an icon set is super easy once you have your starting image:

  1. Copy your image
  2. Paste it onto the icon in the Get Info window
  3. Copy the new icon from the Get Info window
  4. “New from clipboard” in Preview (or just ⌘ N)
  5. Save…
  6. Option click the Format dropdown and choose ICNS
  7. Save

You now have an ICNS file with all 10 variations in it:
Screenshot showing 10 different icons

Step 2:
Paste your image onto the icon in the Get Info window

Step 3:
Copy the new icon set from the icon in the Get Info window

Step 6:
Option click the Format dropdown to expand the available types and choose ICNS

So happy to solve a longstanding performance bug! πŸŽ‰

I finally solved a hugely annoying performance bug in one of my Rails apps! To give you an idea of how bad it had gotten, just before the fix an admin page I use 5-10 times every Saturday was averaging 21,114.2 milliseconds per load!!! 😱 Although really, when the times are that large, milliseconds is probably the wrong unit of measurement… That page was taking 0.00024 days to load!!! And the trend was only getting worse!

That same page is now averaging 22.4 milliseconds, about 3 orders of magnitude quicker!

I’d been trying to figure it out for months but I was hampered by a combined lack of:

  • motivation; public facing pages were “only” taking 2-4 seconds and no one had complained
  • expertise; I’ve never had to solve performance problems on my own before
  • tooling; I had inexplicable issues getting Rack Mini Profiler flamegraphs to work on the site, in development or on production πŸ€·β€β™‚οΈ

The tooling problems were particularly frustrating so I owe a massive thank you to Nate Berkopec from Speedshop who not only puts out a ton of great content but was also very patient with my beginner questions about why my flamegraphs weren’t working. I didn’t end up figuring out that problem, but at Nate’s suggestion I switched to rbspy to create a flamegraph and within about an hour I’d figured out the problem that I’d previously spent months off and on trying to solve.

It turns out that every time I fetched a person from the database, my app was generating a random password for them. That process is a bit slow (possibly by design? to avoid timing attacks?? maybe???). Individually, 200 milliseconds to generate a password isn’t a big deal… but on the admin page I load a list of all the people, so every time a new person got added, the page slowed down by another 1/5 of a second πŸ€¦β€β™‚οΈ

In the end the fix was super simple, I now only generate the random password (and other default values) if the person isn’t already in the database:

# Before
after_initialize :set_default_values

# After
after_initialize :set_default_values, if: :new_record?

18 more characters to remove a 94,160% slow down! Plus now the user facing pages are down below 30 milliseconds too! πŸ₯³

For future reference, here’s how I tracked down the issue:

  • Installed rbspy using homebrew
  • Obtained my web server process’ PID from tmp/pids/server/pid
  • Captured a trace on my Mac using sudo --preserve-env rbspy record --pid 86229 --format speedscope --subprocesses
  • [Not tested but could maybe combine the above two steps with something like sudo --preserve-env rbspy record --pid `cat tmp/pids/server/pid` --format speedscope --subprocesses]
  • Request the offending page or pages then go back and end the rbspy recording with control-c
  • Drag the resulting speedscope file from ~/Library/Caches/rbspy into speedscope
  • Found the offending call at the very bottom of the flamegraph “stalactites”