Numbered Block Params In Ruby
Ruby 2.7 added some syntax sugar that has been making my life easier at work; no longer do I need to use `a` as my "placeholder" variable in enumerators, instead, we have a built in "numbered" block parameter!
Very infrequent posts about whatever I have going on

I recently saw some photos of woodworking online that I really liked. The pieces looked professional, nicely finished, and exactly the kind of thing I’d love to build myself someday. I started to plan out the build in my head, and as I did, I zoomed into the joinery to see how things were built and I was a bit surprised…

I built a bench, and I’m proud of it! I modified a design that I had previously used for a coffee table and got the wood from a local lumbermill in my town. Check it out!

When Postgres operations obtain table-level locks, subsequent operations wait in a queue, but if there are any lock contentions in that queue, long-running queries have the potential to back everything up and can sometimes take down entire applications!

ActiveRecord has a method called take that returns a single record similar to first, except take doesn’t order the records before selecting one. This can GREATLY increase performance in some circumstances; the latency graph above shows a real-life example of take significantly reducing the duration of an api call by changing a single first to take.
Ruby 2.7 added some syntax sugar that has been making my life easier at work; no longer do I need to use `a` as my "placeholder" variable in enumerators, instead, we have a built in "numbered" block parameter!
While Postgres offers an ENUM type, the general recommendation is NOT to use it, here I discuss why and give an alterative solution that I prefer: creating a new table and referencing foreign keys
Ambush! is a solo WW2 strategy game where you command a squad of US soldiers through 8 different missions which you can link together into a longer campaign. Each mission has different victory conditions and mission-specific rules that change the behavior of the map, limit the equipment you can bring or variations keeping the scenario unique and interesting.
For some reason I could not find good information on this (maybe because it’s obvious). But you can add NOT into your Postgres CHECK CONSTRAINTs; this is particularly useful when you find a nice succinct way to express the negation of the constraint you want.
Ruby has a neat function in Enumerable called partition that can split the values in the enumerable into two partitions based arbitrary logic.

During a recent effort at work to optimize database performance we found a bunch of queries which our Rails application triggered but, since the query took longer than our configured HTTP timeout, the transaction was later abandoned. We had initially thought that PgBouncer might have a setting to cancel queries after a request times-out, but that doesn’t seem to be a feature that PgBouncer…