- Short Ruby Newsletter
- Posts
- ๐ Issue #11 - 19-25 September 2022
๐ 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.
๐ 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:
๐ 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:
๐ค 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
Newsletters
๐ 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
Articles
๐ 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 ๐ง
Videos
๐ฅ 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:
Reply