- 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