👋 Issue #11 - 19-25 September 2022
The one with with Phlex components
If you want a short excerpt of this newsletter containing only some of the images with code, I created one here. But I invite you to read the entire newsletter as it has excellent content 😊.
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.
👉 Schwad shared how quick it is to prototype ideas with Rails 7:
👉 Brad Gessler shared a snippet of code that will help you not leak instance variables in partials in Rails:
You can check a working example on the public project Brad shared on Github.
👉 Emmanuel Hayford explained what is the meaning of the i in the shorthand syntax for creating an array of symbol %i:
👉 Thiago Massa shared a code sample about doing a direct grep in tasks:
👉 Kevin Newton shared shared a proposal for implementing NilClass in Ruby and it seems to be faster when done this way:
Here is how it will look like:
Read more about this including the benchmark run in the Ruby master ticket.
👉 Kirill Shevchenko shared code sample about a common useful pattern when using Service Objects to encapsulate initializer in a call on the class:
In the same thread two gems that are helping to do this were shared: serviz and operators-service
👉 Vinicius Stock shared thread with VSCode tips for Ruby:
“CMD + SHIFT + O: fuzzy search symbols on a file” - source
“CMD + T: fuzzy search symbols everywhere” - source
“F2 for renaming local variables, instance variables, methods or constants” - source
👉 Martin Spickermann shared about bang method a quote from Matz:
I tried to find the original source for this and it appears to be this forum discussion.
👉 Emmanuel Hayford shared a code sample showing how super_method works:
👉 Kirill Shevchenko shared about using retrying in Ruby by using retriable gem:
👉 Marco Roth shared a small and very pre alpha library to transform ERB into Phlex. Source code can be found here and you can play online with it at phlexing.fun:
👉 Shino Kouda shared using `app` and `helper` methods in Rails console:
👉 Brad Gessler shared a code sample showing the nested layouts technique inspired from middemanapp:
Check the playground created by Brad on Github for a more detailed explanation of how this works.
👉 Greg Navis shared a validator with a proc that returns allowed values:
👉 Eric Berry shared a code sample about how to chain operations in Ruby:
Joel Drapper shared an alternative for chaining using conditional object yielders:
👉 Moses Gathuku shared a code sample about using conditionals to set classes:
👉 Kirill Shevchenko shared how to use JSON.parse and parse into a custom array and hash classes:
When using OpenStruct please be aware that it comes with a performance penalty.
👉 Nate Berkopec shared advice about the number of processes per contain and preforking webservers:
And Andrey Novikov added an explanation:
👉 Brad Gessler shared a thread about using your component systems/libraries over for example simple_form or any building gems:
He later on shared some experiments he did with Phlex that will land later in the sitepress.cc.
Here is an example of a Phlex component that will rend a markdown:
You can find the code in his view-playground on Github. Joel suggested in the thread that the result of Rouge to the syntax highlighting is cached, thus having a slight performance improvement when rendering.
👉 Mike Perham asked if anyone is actively working on removing Global VM Lock/GVL (also named Global Interpreter Lock/GIL) in Ruby:
He described the primary use case of this change as regarding Rails app that can’t scale without managing multiple processes.
Here are two replies from Yukihiro Matz and Jean Boussier (please read the entire conversation for more context)
👉 CJ Avilla shared a Github repo where he played with Phlex and Sinatra:
You might want to check this Github Repo created by Ren Guoy where the deploys some Phlex.fun components on AWS Lamdba using Serverless.
👉 David Colby shared that among the biggest changes in Turbo 7.2.0 is the ability to respond to a GET request with Turbo Stream:
If you read so far and you like the content, maybe you take into consideration sharing this and subscribe:
Related (but not Ruby specific)
🤔 Brandon Weaver shared about growth and learning
And it got some interesting replies:
🤔 Nate Berkopec asked a question about DX and automating dev workflows:
A summary of the answers that were written as reply to the question:
🤔 Shopify Engineering asked about:
Here are some answers (including them here does not mean I agree with all of them, but I think they are interesting to think about).
Read the entire conversation, it had some interesting ideas; and I always like to challenge my beliefs/principles and think about what I miss or what I have to learn.
🤔 Simon Willison shared asked about how to explore a CSV file with 100_000 rows
He shared his solution to this question, but there were a lot of ideas in the conversation.
🤔 Brandon Weaver wrote about how to promote as a senior:
🤔 Jerome Hardaway shared that engineering management is as simple as going to all the meetings so the team does not have to:
🤔 Collin shared an alias for resolving merge conflicts with Vim:
🤔 Thomas Steiner shared a draft PR about implementing importmaps in WebKit:
Articles and Videos
Courses or Books or Communities
🎤 Paweł Dąbrowski shared the deck he used when delivering the “Sidekiq on the surface and under the hood” presentation at @wrocloverb this year. See it here
📒 Hanami Mastery shared they are opening access for Hanami Mastery PRO - a way to support their work and also get learning benefits in exchange (early access to courses and books, community access, priority support, and more). Join here.
🎤 Ruby Conf Mini shared in a series of tweets on this main thread the speakers at RubyConf Mini. Read the thread to learn more about the speakers and the topics they will address.
Something to read
📖 Aurelie Verrot shared they launched 35 edition of Women on Rails. Read the english version here. This edition has the content localized in French, Italian and Spanish
📖 Greg Molnar shared they released the latest This week in Rails
📖 Andrew Mason shared a new number of The Ruby Radar: #69 Turbo Brisket
📖 Sam Ruby shared a technology preview of what he calls “Terraforming Rails”. It is worth reading the RFC for this where Sam explains what he tries to achieve and maybe also see the video demo of the current state of this tech where he deploys to fly.io a newly created Rails 7 app. I think (just a personal opinion) that this is very close to a concept that we could name ActiveDeployment.
📖 Colin Loretz shared an interactive tutorial he found about practicing PostgreSQL skills: Enhance your Postgres skills
📖 Kevin Murphy shared an article they wrote about organising RSpec test doubles. Read Symmetric Spies: RSpec Test Organization
📖 David Colby wrote an article showing infinite scroll with Rails, Turbo Stream and Stimulus by using Turbo 7.2.0. He also shared another article he wrote about Building a modal form with Turbo Stream GET requests.
Something to watch 🎥 or listen 🎧
🎥 Aaron Patterson announced he would do a live stream with Vinicius Stock. Subscribe here to be notified when it will start.
🎥 Hanami Mastery shared their first episode of Hanamy Mastery PRO about working with ROM repositories. See Leverage ROM repositories
🎥 Wroclove.Rb shared all videos from 2022 edition. See wroc_love.rb 2022
🎥 Adrian Marin shared his presentation at Wroclove.rb about engine automation. See How To Package A Rails Engine Generation To Automation
🎥 Yaroslav Shmarov (Supe Rails Yt) shared their video presentation from WrocLove.rb about using hotwire and viewcomponent in production. See 18 months of using hotwire and viewcomponent in production
🎥 Drifting Ruby shared the video newsletter for This Week in Rails. See This Week in Rails Sept 23rd, 2022
🎥 The Rubber Duck Dev Show released a new episode with Andrew Atkinson. Listen Scaling All the Things! with Andrew Atkinson
Audio & Podcasts
🎧 Jason Swett shared the latest episode of Code with Jason where he talks with Alex Evanczuk about maintaining large Rails apps. Listen 162 - Large Rails Apps
🎧 Ruby For All shared a new episode about Continuous Integration. Listen Episode 9 - Getting Started with Continous Integration. If you want to find reasons to listen to this podcast, you should check this discussion, where many people gave lovely feedback about this podcast.
🎧 Andrew Mason shared a new episode of Remote Ruby where they discuss Storybook, Tailwind, components, JIT and Purge CSS. Listen You Gotta Risk It For The Brisket
🎧 Joel Quenneville shared a new episode for The Bike Shed where he talks with Geoff Harcourt about test infrastructure and faster CI. Listen 355: Test Performance
Gems, Libraries, and Updates
🧰 Koichi Ito shared the latest release of Haml 6, which is faster 1.7x than Haml 5. Read changelog
🧰 Tim Riley shared Hanami 2.0.0.beta3, which now supports reloading inside the console. Read changelog
🧰 DHH shared that Turbo 7.2.0 was released and it has a lot of new features and bug fixes. Check the release changelog
🧰 Nate Hopkins shared that he is working on two libraries TurboReady adding more power to Turbo Streams, and TurboReflex, adding more power to Turbo Frames.
Here are some code samples from TurboReady:
And here are some examples from TurboReflex:
🧰 Adam shared a new library that allows writing web, mobile, and desktop apps powered by Flutter by writing Ruby code. So far, the core works but supporting the UI is still WIP. See the project here.
🧰 Joel Drapper shared they released Phlex.fun version 0.2.2. Read the changelog.
🧰 Kasper Timm Hansen announced a new version of active_record-associated_object gem. It now supports code to remove Active Job boilerplate:
🧰 Sinatra released version 3.0.0. Read the changelog.
Please consider sharing this on social media or with your colleagues:
Wow man this is huge. I can apply right now only a few advices/approaches/gems enumerated here, but your work on collecting all this stuff is outstanding!
I think the best one I've got is "if !condition is more readable than unless", this bothered me for a long time, but now I'm gonna change my rubocop rules.