YouPlot: CLI Tool to Draw Plots on the Terminal— 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 if you want to pull off similar things in your own code. Red Data Tools |
Stripe's CEO Mentions Their In-House 'Ruby Compiler'— 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) 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 |
Fast Rails Deployment on Bare Metal Servers— 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'— 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 |
▶ Discussing WNB.rb and Creating a Community— A chat with Jemma Issroff (who writes our tips of the week), Emily Giurleo and Sylwia Vargas about WNB.rb, a monthly Ruby meetup for women and non-binary people, and what it takes to build community generally. The Ruby on Rails Podcast podcast |
Hint is Hiring— We are on a mission to help all software teams reach their full potential. You can help.
Hint |
Find a Job Through Hired— Create a profile on Hired to connect with hiring managers at growing startups and Fortune 500 companies. It's free for job-seekers.
Hired |
|
premailer-rails: CSS Styled Emails Without Hassle— 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 |
HTTP.rb 5: The Fast Ruby HTTP Client— 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 |
💡 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: String#ljust and String#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 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 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 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. |
|
|