Image of Lucian Ghinda writing for notes.ghinda.com Short Notes
Short posts mostly about Ruby and Ruby on Rails. You can find me at : Linkedin, Mastodon, Twitter or for longer posts at allaboutcoding.ghinda.com
Subscribe via RSS here

See you at EuRuKo 2024

This week, I'll be at EuRuKo 2024 , where I'll speak on two subjects close to my heart: 1. Systematically writing tests to cover more business logic with fewer test cases - Thursday at 14:00, Third Track 2. Keeping Ruby relevant by using new language features - Friday at 15:20, Main TrackIf you are there, let's meet and talk about Ruby, the future, and how to attract new people to learn Ruby and Rails. Looking forward to hearing your ideas.  Find me on social media at:  • Ruby.social - @lucian • X/Twitter - @lucianghinda • Linkedin - /in/lucianghinda • BlueSky...

Short Ruby Newsletter - edition 106 published

The one about Rails performance benchmarks, new Array#fetch_values method and Rails launched an official video series with tips and best practices.  🚀 Launches • Ruby on Rails launched a new video series called Rails in Focus created by Emmanuel Hayford • Alexandre Ruban is working on a new tutorial about the New Rails Authentication Generator (similar with the hotwired.dev) • Events: Friendly.rb shared the latest update about speakers and outdoor activities and Ahmed Nadar with AppSignal launched the AppSignal's Guide to Toronto for Rails World 👉 All about Code and Ruby:  • Takashi Kokubun announced Ruby 3.3.5 is published and...

Friendly.rb Ruby Conference updates

In case you have missed the social media announcement let me share here the ✨ Two weeks before Friendly.rb 2024 Update ✨ 👩🏼‍🦰 Speaker announcementsWe're happy to announce three new speakers for this year's edition:  • Naijeria Toweett • Benjamin Wood  • James Carr from Stripe They are going to speak about building the community, complexity and legacy code, and about the day in the life of 2,000 developers at Stripe. 🎟️ Nearing sold-outWe are nearing the sold-out mark so if you were on the fence, you should act now 😬 https://friendlyrb.com/tickets 🏕️ Outdoor activitiesWe have confirmed the Friday trip: ...

What tests would you write for these two simple Ruby objects

Imagine you wrote this simple PORO in your Ruby on Rails app: class CreditCard::AgeValidator def initialize(age) @age = age end def valid? return true if @age >= 18 false end endWhat tests would you write for it?  What cases would you cover with your tests? How many tests would you write? What about this update_required? method.  What cases would you cover when testing Account#update_required?  What cases would you cover with your tests? How many tests would you write? class Account < ApplicationRecord # t.date "expires_at" # t.string "website" def update_required? website.blank? || expired? end def eternal? = expires_at.nil? def expired?...

Three Ruby Links #3

If I were to recommend three articles published last week to read, here is what I would recommend: 1️⃣ The Thread API : Concurrent, colorless Ruby by JP CamaraJP Camara continues their series about concurrency, parallelism, and async programming  and this one is about threads. It is a deep dive into Ruby threads with a lot of code samples. 2️⃣ Ruby shebang behavior by Ashok Gautham JadatharanAshok found an interesting allowed behavior from CRuby interpreter that allows to create scripts that can run both bash and Ruby commands. The article shows code samples about how to do this. 3️⃣ How...

Short Ruby Newsletter - edition 105 published

🚀 Launches • Web Crunch launched the Hello Hotwire course - free with premium build-along modules • Brad Gessler launched Terminalwire - Hotwire, but for command-line apps • Alex Rudall launched Awesome Ruby Places - a Github repo to gather all companies that are working with Ruby • Tatsu announced the release of English tranlation for the "mruby handbook - Programming mruby by Example" 👉 All about Code and Ruby:  • DHH announced that Kamal 2 is close and the plan is to deploy in less than 20 seconds (it seems like HEY is already running on the alpha version)...

Bash one line to display git commit message without indentation

I like to write explanatory git commit messages and if the PR/MR has one single commit, I use the commit message as the body of the Pull Request/Merge Request. Using the simple git log command displays the commit message but has some padding/indentation: There is a way to fix this by specifying the format:  git log -1 --pretty='format:%s%n%n%b'Where: `%s` is the subject of the commit message (the first line) `%n` is adding a new line (so I am adding two) `%b` is the body of the commit messageYou can make these bash aliases.  alias .lastmsg="git log -1 --pretty='format:%s%n%n%b'"And in case...

Code Design - What would you choose?

Context Consider a list of predicates for an object and the fact that there is a logical priority of considering them. This is just an example, so please do not focus on the requirements themselves.  If an account is _archived_ or _closed_ then that is the final status (**Archived** or **Closed**) and everything else should be ignored. Eg: - An account _not verified_ and _closed_ is **Closed** - An account _not verified_ and _archived_ is **Archived** If an account is _active_ and _not verified_ the status should be **ActionRequired**. Else if the account is _active_ and _verified_ the status should...

Three Ruby links #2

If I were to recommend three articles published last week to read, here is what I would recommend:  1️⃣ Data Modeling Entitlements and Pricing for SaaS Applications by Garrett DimonGarrett explains how the pricing structure chosen will affect the code. He then shares how Flipper is changing its pricing from per-seat to a simpler structure while explaining, with code samples, how to make the code easier to change and simpler. Read the full article 2️⃣ Under the Hood: Enhancing Karafka’s CPU and Memory Efficiency by Maciej MensfeldMaciej shares his journey in making performance improvements for memory and CPU at Karakfa....

Short Ruby Newsletter - edition 104 published

Launches, Discounts and Events • Josef Strzibny (pre)launched a new book "Test Driving Rails: Take Minitest and Fixtures for a spin • "Nate Berkopec announced the launch of his new retainer service Ruby on Rails Performance Service • Rails Plan launched the Web Application Metadata Markup - a simple structure that describes the nature of a web application. • There are at least 9 Ruby meetups happening this week all over the world • Scotland Ruby User Group announced a new conference for Ruby - Haggis Ruby - happening on 24 October 2024 All about code • Xavier Noria celebrates...

Three Ruby Links #1

If I were to recommend three articles published last week to read, here is what I would recommend:  1️⃣ The Fixing the Rails 7+ networking stack  by Thomas Cannon Thomas explores the tech stack he chose for building his project, Little CRM. I like articles where people explain their decisions when building a new product. This article is a very good deep dive, covering the whys and hows with code samples for the chosen tech stack. 2️⃣ An Introduction to HTTP Caching in Ruby On Rails  by Julian Rubisch This is a very good deep dive and also a tutorial...

Reminder about Friendly.rb - one month to the conference

Your friendly reminder about Friendly.rb - there is almost 1 month until the conference.  I am enthusiastic about moderating a panel about #Ruby at Scale. All four guests have great stories to share about scaling Ruby in various settings and configurations. We plan to talk about Ruby and Rails at scale from performance, team and developer experience perspective.  My focus will be to extract concrete examples and advices for anyone that is starting a project today and is concerned with the idea of scaling a Ruby on Rails project. Checkout the full agenda and tickets at https://friendlyrb.com We have a...

Short Ruby Newsletter - edition 103 is out

Launches, Discounts and Events • Luke announced the pre-launch of PetPals.app - Unleash friendships with PetPals • Ruby on Remote launched their section about Remote companies using Ruby showing 1247 companies that were hired in the last 3 years Ruby developers • Glauco launched Even Better Specs - guidelines for maintainable tests • Ganesh launched their ebook Essential Brand Guidelines Book for Startups • Ruby Conf is looking for conference volunteers • At least three meetups are happening this week in Turkiye, Switzerland, and Poland, and a conference is taking place in Japan.  All about code • You will see...

Written by Lucian Ghinda - Senior Ruby Developer by day, Curator of Short Ruby Newsletter during weekends