#​553 — May 20, 2021

Read on the Web

Ruby Weekly

▶  Talks from RailsConf 2021 — There's an official playlist with only 10 videos or you can trawl through Ruby Central's channel to find the rest. There's a lot to enjoy, but here are some of the early highlights for us:

Ruby Central (YouTube)

Try Scout’s Leading-Edge Performance Monitoring for Free — Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues in minutes. See for yourself why Scout is a Node developers’s best friend with a free 14-day trial, no credit card needed.

Scout APM sponsor

▶  'Why Is It So Hard to Find Ruby Developers?' — Host Ben Popper and Ilya Bodner of Bold Penguin cover an interesting challenge in the Ruby recruitment space amongst other things relating to building a company’s tech around Ruby.

The Stack Overflow Podcast podcast

TruffleRuby 21.1.0 Released — TruffleRuby is a Ruby implementation that runs on the GraalVM JVM and boasts peak performance beyond that seen in other implementations.

Oracle

A Rubyist's Walk Along the C-side: Calling Methods — The third part in the series (we linked to the first one in issue 546), this covers not just calling methods but also variable and keyword argument scenarios.

Peter Zhu

📘 Articles & Tutorials

How to Generate Pixel Art Characters from Ruby — This is pretty cute and gives you some good options for randomizing the output.

Gerald Bauer

Limit Your Automatic Retries — Let’s say you’re catching an exception raised by an intermittently unreliable third party API - should you just retry endlessly? No. An elegant and simple “one retry” approach is shown here.

Rafal Lasocha

[Guide] The Truth About Developer Productivity Metrics — What you need to know to avoid weaponizing metrics for performance reviews, and use them to accelerate releases instead.

Sleuth sponsor

Hybrid iOS Apps with Turbo — A six-part series that covers Turbo, when to use JavaScript, and how to drop into SwiftUI when you really need it.

Joe Masilotti

The Ruby C API Definitive Guide — Maxwell has created a guide for the “huge and largely undocumented” C API and you’ll need to be pretty comfortable with both C and Ruby to use it.

Maxwell Anselm

Automatically Avoiding GraphQL N+1s — Justin and his colleagues at Aha! Engineering address the dreaded N+1 issue with GraphQL by making batching a simple configuration item.

Justin Weiss

A Robust Distributed Locking Algorithm Based on Google Cloud Storage — The co-creator of Passenger needed a way to coordinate concurrent workloads with distributed locks and has come up with an approach.

Hongli Lai

Write Detailed RSpec Example Descriptions“RSpec examples should have enough detail in the descriptions to rewrite them from scratch,” argues the author.

Tom Dalling

How to Monitor Sidekiq Process Uptime in Rails Apps
Paweł Urbanek

Debugging Slow Heroku Builds
Matt Swanson

Jobs

Ruby/Backend Engineer — We’re seeking an engineer to join us and help transform presentations and meetings into fun, interactive experiences. We’re a friendly, English-first startup based in Stockholm, Sweden.
Mentimeter

Senior Software Engineer (US - Remote-Friendly) — Snapdocs is going through a hyper-growth phase, looking for empathetic Senior Software Engineers as we scale our product and team.
Snapdocs

Find Ruby Jobs with Hired — Take 5 minutes to build your free profile & start getting interviews for your next job. Companies on Hired are actively hiring right now.
Hired

🛠 Code and Tools

TTY::Sparkline: Sparkline Charts for Terminal Apps — Yet another fine addition to the range of TTY toolkit libraries. This time you can plot sparklines (perhaps more accurately “sparkbars”, in this case) on the terminal for showing condensed streams of values in an easily followed way.

Piotr Murach

S3AssetDeploy 1.0: Deploy and Manage Static Assets on Amazon S3 — ..with rolling deploys and rollbacks too.

Loomly

We Babysit Your Heroku Dynos So You Don’t Have To

Rails Autoscale sponsor

Choosing a Rails XML Serializer for Your API in 2021 — XML is still a thing, so if you need it, you need it.

Callcounter

Lamby 3.0: Simple Rails & AWS Lambda Integration — You may recall we interviewed the creator of this tool back in December. In short, it makes creating elaborate serverless Ruby apps for deployment on AWS Lambda as easy as possible by providing a simple Rack adapter.

Custom Ink

💡 Tip of the Week

Helpful MatchData Methods

Regular expression matches against strings return MatchData objects. In this week's tip, we'll look at three different methods to call on MatchData objects to get the data we're looking for.

We'll follow an example of matching against a URL using this (excuse the awkward wrapping due to the limitations of email):

match = "https://rubyweekly.com/issues/537/"\
        .match(/(\w+).com\/.*\/(\d+)/)
=> #<MatchData "rubyweekly.com/issues/537/"
               1:"rubyweekly" 2:"537">

1. MatchData#captures gives us an array of only the captures from the match. It's the same as match.to_a[1..-1]:

match.captures
=> ["rubyweekly", "537"]

2. MatchData#pre_match and MatchData#post_match give us the parts of a String that appear before and after a match.

match.pre_match
=> "https://"

match.post_match
=> "/"

3. We can name captures by passing a ?<name> inside the capture group, like this:

match = "https://rubyweekly.com/issues/537"\
        .match(/(?<issue>\d+)/)
=> #<MatchData "537" issue:"537">

match["issue"]
=> 537

Try these out the next time you're using Regexp matching.

This week’s tip was written by Jemma Issroff.