---
title: "Letting GitHub write your Ruby for you..."
publication: "Ruby Weekly"
issue: 559
published_at: "2021-07-01"
canonical_url: "https://rubyweekly.com/issues/559"
---

Plus Stripe's CEO chimes in, and the tip of the week is back. |        

#​559 — July 1, 2021 

[Read on the Web](https://rubyweekly.com/issues/559)    

Ruby Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/yrmdu3gx24qc8g3cuw4k.jpg)](https://github.com/red-data-tools/YouPlot)   

[YouPlot: CLI Tool to Draw Plots on the Terminal](https://github.com/red-data-tools/YouPlot) — A bit random, but I was struck by how neat this little Ruby-powered terminal-based plotting tool was. I encounter so many such tools written in Rust or Go nowadays that seeing one in Ruby is a delight. The underlying plotting library is [unicode_plot.rb](https://github.com/red-data-tools/unicode_plot.rb) if you want to pull off similar things in your own code. 

Red Data Tools   

[Stripe's CEO Mentions Their In-House 'Ruby Compiler'](https://twitter.com/patrickc/status/1410269843585069056) — Am I impressed at the CEO of a company valued at $95bn tweeting about Ruby? Yes, I admit it. In short, this is just a tweet, but Stripe (who also build [Sorbet](https://sorbet.org/)) claims to have an ‘_in-house Ruby compiler_’ yielding 22-170% more performance than CRuby when powering Stripe’s API server. 

Patrick Collison on Twitter   [![\](https://copm.s3.amazonaws.com/ffdb7d4f.png)](https://blog.cloud66.com/maxihost-partners-with-cloud-66/?utm_source=cp&utm_medium=n&utm_campaign=rubyweekly-21-q3-1) 

[Fast Rails Deployment on Bare Metal Servers](https://blog.cloud66.com/maxihost-partners-with-cloud-66/?utm_source=cp&utm_medium=n&utm_campaign=rubyweekly-21-q3-1) — Maxihost & Cloud 66 have partnered to make deploying and managing Rails applications on bare metal servers faster and easier. Get the power and flexibility of bare metal with the speed and simplicity of Cloud 66. 

Cloud 66 + Maxihost sponsor   

[GitHub Copilot: An AI 'Pair Programmer'](https://copilot.github.com/) — A project that GitHub has been working on in the background for some time with OpenAI. It’s a VS Code extension that uses machine learning to suggest useful code snippets as you type – it works really well with Ruby and I've had a lot of fun playing with it. I'll be sharing a post with how it works, specifically for Rubyists, next week. 

GitHub   

[Creating Google-Like Letter Avatars with ERB-Generated SVGs](https://kukicola.io/posts/creating-google-like-letter-avatars-using-erb-generated-svgs/) — You don’t need a graphics library to create simple avatars, as SVG can be generated on the fly with ERB, as shown here. Interesting approach. 

Karol Bąk   

**IN BRIEF:** 

- [Ruby Toolbox](https://www.ruby-toolbox.com/), a neat way to find Ruby libraries, [now displays gem dependencies](https://www.ruby-toolbox.com/blog/2021-06-29/rubygem-dependencies) on project details pages – check out [Cucumber's](https://www.ruby-toolbox.com/projects/cucumber), for example.
- A [thread on the ruby-build repo](https://github.com/rbenv/ruby-build/issues/1775#issuecomment-872156646) provides a reminder that Ruby versions do become 'extinct' and upgrading or rewriting old code becomes a necessity if you want to keep running it..  

📕 Tutorials  

[Set Up a Docker Container To Test Your Rails App](https://www.honeybadger.io/blog/testing-rails-with-docker/) — This is a use case tailor made for containers, which enables consistent environments and simple dependency mocking leading to more reliable tests. 

Milap Neupane   

▶[Configure Anything with Dry::Configurable](https://hanamimastery.com/episodes/5-configure-anything-with-dry-configurable) — Stop rolling your own config classes and use this threadsafe, flexible, simple-to-use gem that handles just about any use case you can imagine. 

Hanami Mastery   

[Using Multiple Databases in a Single Query in Rails Apps](https://karolgalanciak.com/blog/2021/06/27/using-multiple-databases-in-a-single-query-in-your-rails-app-postgres-foreign-data-wrappers-to-the-rescue/) — You’re probably never going to need to do this, but if you do.. Postgres’s FDWs are very handy and will even let you work with other databases that aren’t Postgres. 

Karol Galanciak   

[Rails 7 Adding Audio Metadata Support to ActiveStorage](https://blog.saeloun.com/2021/06/30/rails-7-adds-audio-analyzer-to-active-storage.html) — Rails 6.2 added [a mechanism](https://github.com/rails/rails/pull/30944) for extracting metadata from images and videos, but Rails 7 will go a step further with audio, to get things like length and bit rate by calling out to [ffprobe](https://ffmpeg.org/ffprobe.html), a part of FFmpeg. 

Deepak Mahakale   

[Free eBook: Efficient Search in Rails with Postgres](https://pganalyze.com/ebooks/efficient-search-in-rails-with-postgres?utm_source=RubyWeeklySecondary07012021) — Speed up a search query from seconds to milliseconds and learn about exact matches, trigrams, ILIKE, and full-text. 

pganalyze sponsor   

[Using Redis Hashes for Caching in Rails](https://engineering.mrsool.co/using-redis-hashes-for-caching-in-ruby-on-rails-6dc53df293da) — [redis_hash_store](https://github.com/mrsool/redis_hash_store) lets you use Redis hashes for caching. 

Omar Bahareth   

[Back to Basics: Boolean Expressions](https://thoughtbot.com/blog/back-to-basics-booleans) — The truth is out there. 

Joël Quenneville   

▶[Discussing WNB.rb and Creating a Community](https://www.therubyonrailspodcast.com/373) — A chat with Jemma Issroff (who writes our tips of the week), Emily Giurleo and Sylwia Vargas about [WNB.rb](https://twitter.com/wnb_rb?lang=en), a monthly Ruby meetup for women and non-binary people, and what it takes to build community generally. 

The Ruby on Rails Podcast podcast   

[Calculate the Standard Deviation of a Ruby Array](https://andycroll.com/ruby/calculate-the-standard-deviation-of-a-ruby-array/) 
Andy Croll   

▶[From Zero to Sidekiq Hero](https://longliveruby.com/articles/from-zero-to-sidekiq-hero) 
Paweł Dąbrowski    

Jobs  

[Engineering Manager @ Nebulab (Remote)](https://nebulab.com/careers/) — Join our distributed team and build high-volume eCommerce applications in a workplace made by developers for developers. 
Nebulab   

[Hint is Hiring](https://hint.io/careers) — We are on a mission to help all software teams reach their full potential. You can help. 
Hint   

[Find a Job Through Hired](https://hired.com/join/?utm_source=newsletter&utm_medium=sponsor&utm_campaign=%28b2c%29%28l-all%29%28r-all%29%28cooper-rubyweekly%29&utm_content=find-your-next-job) — Create a profile on Hired to connect with hiring managers at growing startups and Fortune 500 companies. It's free for job-seekers. 
Hired    

🛠 Code and Tools  

[premailer-rails: CSS Styled Emails Without Hassle](https://github.com/fphilipe/premailer-rails) — [Premailer](https://github.com/premailer/premailer) is a drop-in-and-it-works gem that makes styling emails easy by applying CSS rules without you having to write all the styles inline. We use it as part of the Ruby Weekly production pipeline, but premailer-rails opens it up to Action Mailer too. 

Philipe Fatio   

[Introducing idnx: Converts Internationalized Domain Names into Punycode](https://honeyryderchuck.gitlab.io/httpx/2021/06/11/introducing-idnx.html) — Punycode is a way to represent Unicode with the limited ASCII character set. 

HoneyryderChuck   

[Still Not On Rails 6.1? FastRuby.io Can Help](https://fastruby.io/?utm_source=rubyweekly) 

FastRuby.io | Rails Upgrade Services sponsor   

[HTTP.rb 5: The Fast Ruby HTTP Client](https://github.com/httprb/http) — My favorite Ruby HTTP library nowadays. The 5.0 release switched to the `llhttp` parser, improved modern Ruby support, added HTTP 1XX code response support, and more. 

http.rb team   

[Amoeba: Easy Cloning of Active Record Objects (Including Associations)](https://github.com/amoeba-rb/amoeba) — An extremely old library but recently updated and boasting Rails 6 compatibility. 

Vaughn Draughon   

[ValidEmail2 4.0: ActiveModel Validation for Email](https://github.com/micke/valid_email2) — Check the legitimacy of email addresses including MX lookup and checking against a list of disposable email services. 

Micke Lisinge   

[SidekiqUniqueJobs: Ensure Uniqueness of Your Sidekiq Jobs](https://github.com/mhenrixon/sidekiq-unique-jobs) 
Mikael Henriksson      

💡**Tip of the Week** 

**String Formatting**   

We often need to format strings to appear a certain way. This week, we'll cover several formatting and minor manipulation methods on [Strings](https://ruby-doc.org/core-3.0.1/String.html): 

- [`String#ljust`](https://ruby-doc.org/core-3.0.1/String.html#method-i-ljust) and [`String#rjust`](https://ruby-doc.org/core-3.0.1/String.html#method-i-rjust) both take an integer argument, and an optional padding argument. If the length of the string is smaller than the integer, they'll return a new string of the length of the integer, padded with the padding argument repeated to fill the space, or spaces (``) if no argument is passed. `String#ljust` padds on the right of the string, and `String#rjust` pads on the left: 

```
"This string needs a length of 35"\
                 .ljust(35, "asdf")
=> "This string needs a length of 35asd"

"This string is already longer than 35"\
                              .ljust(35)
=> "This string is already longer than 35"
``` 

- [`String#center`](https://ruby-doc.org/core-3.0.1/String.html#method-i-center) behaves the same as `String#ljust` and `String#rjust` except it pads on both sides (with extra padding on the right in the case of an odd number of padding characters: 

```
"String".center(10)
=> "  String  "
``` 

- [`String#delete_prefix`](https://ruby-doc.org/core-3.0.1/String.html#method-i-delete_prefix) takes a parameter of the prefix to delete, and does exactly what it claims. It is also faster than `String#sub` or `String#gsub`: 

```
"id_12345".delete_prefix("id_")
=> "12345"
``` 

If the prefix doesn't exist, it will return the original String: 

```
"12345".delete_prefix("id_")
=> "12345"
``` 

- [`String#delete_suffix`](https://ruby-doc.org/core-3.0.1/String.html#method-i-delete_suffix) works just like `String#delete_prefix` except it deletes from the end of the string: 

```
"uploaded_image_12.pdf"\
               .delete_suffix(".pdf")
=> "uploaded_image_12"
```    

Please note that the `\` formatting is used to prevent the email width going too wide on mobile :-)

This week’s tip was written by [Jemma Issroff](https://twitter.com/jemmaissroff).          

Curated by [Peter Cooper](https://twitter.com/peterc), [Glenn Goodrich](https://twitter.com/ruprict) and [Cooperpress](https://cooperpress.com/). 

[Change your email address](https://rubyweekly.com/edit_subscription/*|UID|*) or[Stop getting this newsletter](https://rubyweekly.com/leave/*|UID|*) 

© Cooper Press Ltd · Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom
