Programming posts of interest
This is list a list of programming articles that I find interesting and may want to reference again in the future. For now I’m going to organize them by language and/or framework.
# Ruby
- Build concurrency control in Sidekiq: This tutorial article shows how one can leverage Redis to lock resources. It’s context is locking Sidekiq jobs, but it would be easily repurposed to lock anything. Also, worth noting, the paid version of Sidekiq (Sidekiq ENT) already has a unique_for option. The general pattern/algorithm this article demonstrates is also discussed in the Distributed locks with Redis docs.
- Configuring Puma, Unicorn and Passenger for Maximum Efficiency:
Shares advice for figuring out how many workers and threads to use for your
server configuration based on available CPU and memory resources. For
example worker_count = 1.5 x (n hyperthreads). There’s also an explanation
of forking and copy-on-write.
- To Thread or Not to Thread: An In-Depth Look at Ruby’s Execution Models Is another look along the same lines, but favors forking processes over spawning threads. It shows how CoW memory works and how to inspect metrics related to it.
- Ruby’s magical Enumerable module:
Shows how to make objects enumerable by creating a
LinkedList
class. See also Make something enumerable for another example. - Don’t waste your time on assets compilation on Heroku: A silly, click-baity title, but an interesting take on piping Rails assets to a CDN.
- Shale: This isn’t a post, but a library for object mapping and serialization. It looks promising.
- Gemfile of dreams: Libraries we use to build rails apps: Evil Martians’ commonly uses Rails libs.
- https://semaphoreci.com/blog/ruby-webassembly: How to webassembly in Ruby as of February, 2023.
- Drifting Ruby: Deploying with MRSK Screen cast of deploying with docker to Digital Ocean using MRSK. There’s a bunch of gotchas to set this up, so worth a watch. This can be used for deploying pretty much anywhere, even on prem. Servers need to be prepared in advance (eg, load balancer, app nodes, database server, etc.)
# Javascript
- https://www.akshaykhot.com/using-hotwire-without-rails/: Explains how to use Hotwire (Turbo primarily) without the RoR framework. What’s nice about this is that it becomes very clear what Turbo is all about.