Issue #8 - 29 August - 4 September 2022
The one with pattern matching
I’m Lucian (@lucianghinda on Twitter), and I am the curator of this newsletter.
🚀 Code Summaries: Last week, I launched a new section on the newsletter website called Code Summaries. The purpose is to summarise technical articles with Ruby code. I started with the idea that most of the time, I first want to see the code and then read an explanation. That section is not sent via email as I plan to publish it several times weekly. But you can subscribe to it if you want; here is how.
This edition was created with support from @adrianthedev from Avo for Ruby on Rails (a friendly full-featured Rails admin panel) and from @jcsrb, who sent me recommendations to include in the newsletter.
If you have any feedback or ideas about this newsletter, please reach out on Twitter or via email at firstname.lastname@example.org
👉 Emmanuel Hayford shared a tip about how to use Kernel method:
👉 Petrik De Heus shared a performance benchmark for running simultaneous connections in Ruby 3.2 thanks to work done by @_k01
See the benchmarks here on Github
👉 Nicolas Alpi 🍪 shared their experience with deploying a Ruby on Rails app on various PaaS providers:
Here are some main things to consider, but please read the entire thread on Twitter (or via TheReaderApp):
Heroku: “Will not be able to achieve multi-region”
Configuring render.yaml can require some time. More focus on deploying infrastructure and not an app
Price is more flexible than Heroku
Works great, documentation is very good once you understand the concept of infrastructure as code
Multi-region: similar with Heroku, the way to do this is to deploy region based apps
Region works great
Encountered various errors from jmalloc to Ruby version
They seem a bit behind answering community questions
Pricing based on usage
Simple to deploy
"For medium size apps (2 web, 1 worker, 1 db, 1 redis) it can quickly lead to similar(ish) cost than Heroku but with bigger servers"
Simple deployment and works out of the box
You manage the actual servers, "These are not managed servers, you will be in charge of them"
👉 Nejdet Kadir shared an example about how to dry-rb to validate params:
👉 Joel Drapper shared new benchmarks for Phlex:
👉 Emmanuel Hayford shared a piece of code about how to restrict a method to accept keyword args:
👉 Facundo Espinosa shared a code example about using |= operator:
👉 A question asked by Facundo Espinosa about what do you use for Admins today in Rails, triggered an excellent answer by Adrian Marin from www.avo.cool about what DSLs are:
And he then goes to balance between writing Rails code and making abstractions:
👉 Nate Berkopec shared advice about how to use Puma and triggered and discussion about how to design the app to call external services:
It is worth reading the thread as is has some interesting takes:
In case you still want Puma with threads, Nate shared in 2021 a good thread about a basic configuration. You should read that Twitter thread as it has more recommendations for various configurations. Here are the main points:
👉 Andrew Mason shared how to use Pry to show source location for methods:
If you are not using Pry, the source location is included in Ruby.
👉 A frustration shared by Benoit Daloze about the defaults of Rubocop, triggered a long discussion with some examples of defaults for cops not working well for some people.
As a result of this Joel Drapper shared they are starting a new project to set up sane Rubocop defaults. The work has not yet started, but he already created a repo for it here at joeldrapper/good_cop
👉 Facundo Espinosa shared a short TIL about reorder in active record:
👉 Ruby Conf Mini shared an announcement about an opportunity scholarship for RubyConfMini. You can directly apply here if you want. Deadline 17 September.
👉 Nate Berkopec shared a proposal about how to name queues: by using their SLAs:
For more insights, you can read this article about how they do this at Gusto.
👉 Julian Rubisch shared a sample code to feature flag a route in Rails when using Devise:
👉 Steve Polito shared advice with a code sample for testing error messages:
👉 Jason Swett shared an experiment to organise tests by feature and not by test type:
The main benefit is:
I can run ALL the tests for a feature or area in one command because they're all grouped in one folder - great for when I want to check for regressions without having to run the entire test suite
Here is how he explains the structure of the test folder:
👉 Drew Bragg shared an old code example about reading __END__ data in multi-file view component:
But there are more ideas about how to do this in this thread started by Konnor Rogers
👉 Thiago Massa shared that merging hash with splat operator is faster (source) than using merge:
He also shared a code sample about how to use pattern matching:
And here is another example shared by Thiago Massa :
And here is an example shared by me where I mix pattern matching with static typing checking and omitting values in keyword arguments:
👉 abuisman shared on Reddit how to rotate credentials key without downtime:
If you read so far and you like the content, maybe you take into consideration sharing this and subscribe:
Related (but not Ruby specific)
Josef Strzibny shared a concise image explaining positioning for CSS grid layout:
Koichi Ito shared shared 3 frames in time when a developer is doing a review of their work:
Vim Tricks shared tip about how to change case in VIM:
Jared White shared a new project about converting Tailwind CSS to Semantic CSS: vanillabreeze.dev:
He wrote a good article explaining how to use utility classes in a maintainable way: The Three Laws of Utility Classes. It is worth reading!
Tobias Petry.Sql shared shared a new SQL tip about how to fill in data gaps automatically in SQL:
Mike Perham shared a good and short insight into marketing:
Thiago Massa shared nice trick to transpile JS in browser:
Gee Paw Hill shared an excellent thread about how we think, and this tweet is an excellent summary of what makes change hard:
Articles and Videos
Courses or Books
Justin shared launched a new Ruby On Rails course: Modern Application Development with Rails
Something to read
🗞 VimTricks released a new edition of their newsletter about Vim here: Vim Search Visual Selection
🗞 Greg Molnar shared they published the latest issue of This week in rails
🗞 David shared a new newsletter with interesting things found on Twitter: Weekly bookmarks - Issue #17
🗞 Ruby LibHunt released their 328 issue of Awesome Ruby Newsletter.
🗞 Ruby Weekly released their 618 issue
🗞 Ruby Radar shared they released their 65 issues: #65 - Fly Away From Heroku
Tom Doe shared an article about Ruby loops overview.
Rubyland shared wrote about how Rails 7 reads ENV[“SCHEMA_FORMAT”] to know the schema format.
The Ruby Dev shared how to set up Git to run static analysis on Ruby/Rails: Read the article here
Tute Costa shared an article about value objects in Ruby, written by Joël Quenneville: Value Object Semantics in Ruby
Chris Oliver shared how they built GoRails into a sustainable business: How This Midwestern Coder Overcame Self-Doubt to Earn Over $1.8 Million Continuing a Community Legacy
Justin Searls shared a new article they wrote about using custom attributes types in Rails and how to use them with forms: Stateless Forms with the Rails Attributes API
Ruby Lib Hunt shared an article about how to write code and think about the principle of least surprise: Keep it boring, don’t surprise me
Something to watch or listen
🎥 Drifting Ruby shared a new episode they published about learning Hotwire: this one they build a Full Calendar for an appointment scheduling program. See it here → Episode 364 - Booking System
🎥 Hanami Mastery shared a new article about using Sidekiq with Hanami: See it here → Integrate Sidekiq with Hanami Applications
🎥 Timnan shared a new tutorial about implementing TimetableJS in Ruby on Rails: See it here → Implementing TimetableJs in Ruby On Rails
🎥 Facundo Espinosa shared an older tutorial done by Mario Visic about building asteroids game with ruby2d: See it here → Building a player select screen - Asteroids Ruby 2D Part 1
🎥 Rubyland shared a collection of RailsConf talks by Shopify engineers. See them here → RailsConf 2022: 10 Shopify Tech Talks You Might Have Missed
🎥 Cj Avilla shared a video released by GoRails about how to deploy to Fly. See it here → How to Deploy Rails to Fly.io
🎥 Drifting Ruby shared the video format of the This week in Rails newsletter: See it here → This Week in Rails Sept 2nd, 2022
🎥 The Rubber Duck Dev Show shared a new episode this time with Drew Bragg. See it here → Episode 57 | Going Off The Rails With Drew Bragg
Audio & Podcasts
🎧 Stephan Hagemann shared a great discussion about modularization and internationalization with Irina Nazarova - CEO @evilmartians. Listen to the recording here → Ruby@Scale
🎧 Jason Swett shared their latest episode from Code with Jason where he talks with Andrew Atkinson about PostgreSQL. Listen to it here → 160 - PostgreSQL with Andrew Atkinson
🎧 Joël Quenneville shared a new episode of The Bike Shed about submitting talks to conferences, case expressions, and good enough. Listen here → The Bike Shed: 352: Case Expressions
🎧 Therubyonrailspodcast shared a new episode where they talk about layoffs. Listen here → Episode 433: The One About Layoffs (Brittany + Brian)
🎧 Ruby For All shared a new episode about pairing with Josh Goldberg. Listen here → Pairing with Josh Goldberg
Gems, Libraries, and Updates
🧰 Avo shared a new release of their Admin for Rails library. This has a lot of improvements: select all matching records, override destructive actions, automatic required option, and more. Check the changelog here
🧰 Aaron Patterson shared a new database adapter for Ruby on Rails called Trilogy:
Compared to the mysql2 gem, Trilogy avoids a dependency on the libmariadb / libmysqlclient library, which can simplify gem installation and eliminate version mismatch issues, and minimizes the number of times data must be copied in memory when building and parsing network packets. It should simplify gem installation and be more efficient under heavy query loads.
Check the gem here, it is compatible with the
main branch of
🧰 Marco Roth shared shared they are working on a new gem providing more power to interact with DOM from Ruby. See the gem here: marcoroth/turbo_power-rails. It adds some very cool actions from DOM actions, Attribute Actions, Event Actions, Storage Actions, Browser Actions, Browser History Actions and more.
Here are just some examples, but there are many more on the Github homepage:
🧰 Pascal Laliberté shared shared a bit of work done for creating a charts library for Rails. Check the website here.
🧰 Sam Aaron 🇪🇺 🇺🇦 shared a new release of Sonic Pi that supports nudging time forward or back to sync the phase with an external rhythm. Read here more about this release.
🧰 Mike Dalessio shared new version of sqlite3 gem. This is v1.5.0.rc2. See the initial release notes of v1.5.0 here
🧰 Sam Ruby shared announced a change to flyctl to allow deployment of Rails via fly.rake. See the RFC: have fly launch produce a lib/tasks/fly.rake. Here is what it might look like:
🧰 Bozhidar Batsov (Bug) 🇧🇬🇪🇺🇺🇦 shared a new release of Rubocop containing small improvements. RuboCop 1.36
🧰 Jeremy Evans shared a new release of Sequel 5.6.0. See change log here
🧰 Eric Berry 💜 🇺🇦 shared a gem created by Igor Kasyanchuk about printing debugging information called Wrapped print.
🧰 Konnor Rogers shared a gist for having a single file view component. Check it out here
This was a long issue as there was a lot of great content that I discovered in Ruby community. I started to follow what is happening on Reddit communities so I will probably start bringing content from there.
Please consider sharing this on social media or with your colleagues: