Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Julia Evans 

A debugging manifesto

Hello! I’ve been working on a zine about debugging for the last 6 months with my friend Marie, and one of the problems we ran into was figuring out how to explain the right attitude to take when debugging.

We ended up writing a short debugging manifesto to start the zine with, and I’m pretty happy with how it came out. Here it is as an image, and as text (with some extra explanations)

1. Inspect, don’t squash

When you run into a bug, the natural instinct is to try to fix it as fast as possible. And of course, sometimes that’s what you have to do – if the bug is causing a huge production incident, you have to mitigate it quickly before diving into figuring out the root cause.

But in…

Awesome Ruby Newsletter 

💎 Issue 342 - Find a mentor in the Ruby community

Code with Jason 

Keep test code and application code separate

Sometimes you’ll be tempted to add things to your application code that don’t affect the functionality of your application but do make testing a little easier.

The drawback to doing this is that causes your application code to lose cohesion. Instead of doing just one job—making your application work—your code is now doing two jobs: 1) making your application work and 2) helping to test the application. This mixture of jobs is one straw on the camel’s back that makes the application code just that much harder to understand.

Next time you’re tempted to add something to your application code to make testing more convenient, resist the temptation. Instead add it somewhere in the code that…

Ruby Weekly 

RIP Chris Seaton

#​632 — December 8, 2022

Read on the Web

Ruby Weekly

In Memory of a Giant: Chris Seaton — It is with much sadness that the Ruby community learnt about the death of Chris Seaton last weekend. Chris worked for Shopify, but was well known as the founder of the TruffleRuby implementation while at Oracle, for being the first(?) Ruby doctor (his PhD thesis about Ruby is here), and generally being an interesting and helpful guy. Justin Searls has posted a tribute post of his own, as has Brandon Weaver.

Aaron 'tenderlove' Patterson

If you are feeling bereft or devoid of hope, please seek a friendly ear to speak with.

Shopify Engineering - Shopify Engineering 

Three Essential Remote Work Practices for Engineering Teams

It’s been around two and a half years since Shopify became a fully remote-first company. James Stanier shares three big learnings that are essential to succeeding remotely.

More

Kevin Newton 

Advent of YARV

This blog series is about how the CRuby virtual machine works. If you’re new to the series, I recommend starting from the beginning. This post is the first of three posts about local variables.

Local variables are everywhere in our Ruby code, and most of the time you don’t have to think too hard about them. They’re the easiest to work with because they’re so immediate. Generally the entire lifetime of a local variable fits neatly onto your screen; from the time they are initialized to the time where they fall out of scope.

Scope is the key word here. What does it mean for a local variable to be “in scope”? In Ruby, there are a couple of different scopes that can be found, which correspond…

Saeloun Blog 

Rails now supports routes prefixed with word cable

ActionCable seamlessly integrates WebSockets with the rest of our Rails application. It allows for real-time features to be written in Ruby in the same style and form the rest of our Rails application, while still being performant and scalable. It’s a full-stack offering that provides both a client-side JavaScript framework and a server-side Ruby framework. We have access to our entire domain model written with ActiveRecord or ORM of our choice.

Rails have resourceful routing. Resource routing allows us to quickly declare all of the common routes for a given resourceful controller. A single call to resources can declare all of the necessary routes for our index, show, new, edit,…

Saeloun Blog 

Enumerable#many? now forwards all block parameters

Enumerable methods can be chained together to form complex queries. For example, to find the first element in an array that is greater than 5 and less than 10, we can use the following code:

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].select { |n| n > 5 }.find { |n| n < 10 }

It is expected that each enumerable method passes the block parameters to the next method in the chain. However, this is not the case with Enumerable#many?.

Before

Let’s look at an example at how a similar method, Enumerable#any?, works. Enumerable#any? returns true if an array has at least 1 element. It also accepts any block or parameter passed to it.

irb(main):01:0> [1, 2, 3].any?(Integer)
=> true
irb(main):02:0> %w[ant…
RubySec 

CVE-2022-23476 (nokogiri): Unchecked return value from xmlTextReaderExpand

## Summary Nokogiri `1.13.8, 1.13.9` fails to check the return value from `xmlTextReaderExpand` in the method `Nokogiri::XML::Reader#attribute_hash`. This can lead to a null pointer exception when invalid markup is being parsed. For applications using `XML::Reader` to parse untrusted inputs, this may potentially be a vector for a denial of service attack. ## Mitigation Upgrade to Nokogiri `>= 1.13.10`. Users may be able to search their code for calls to either `XML::Reader#attributes` or `XML::Reader#attribute_hash` to determine if they are affected. ## Severity The Nokogiri maintainers have evaluated this as [High Severity 7.5…
Honeybadger Developer Blog 

An Introduction To Hanami 2.0

Ruby on Rails is one of the most popular Ruby frameworks in developer circles, but it's not the only one. There are lots of other relatively unknown frameworks, including Roda, Sinatra, and Goliath. Some of these are faster than Rails, packed full of interesting features, and might be the very tool needed for your next project.

In this article, we'll take a look at one such framework: Hanami 2.0.

What is Hanami?

Hanami is a Ruby framework introduced about five years ago and initially called Lotus. The framework is the brainchild of developer Luca Guidi.

On the project's website, Hanami is described as "a modern framework for Ruby". It features fast response times and security features…

DEV Community 👩‍💻👨‍💻: Brandon Weaver 

To Be Known for our Kindness

Content Warning: Death of a Ruby community member

We have lost a great man in the Ruby community in the last week. A man of immeasurable impact, of technical prowess and wisdom, but above all?:

We lost a man of true kindness.

The passing of Chris Seaton has impacted us all, and he will be sorely missed in our community.

A Wise Man

Chris was one of if not the smartest Ruby developers I knew. Heck, he even had a PhD in Ruby and was actively involved in academic circles in pushing the boundaries of what was thought to be possible both in the language and in programming in general.

He was a mentor who guided so many folks, a teacher who empowered others, and a source of…

EquiValent 

Responsibility On Rails

November 2022 I’ve celebrated 13 years of being a Ruby on Rails developer. It just feels like a good time to get something off my chest. Here’s the story:

One project I’ve worked for was originally developed by a dude who used Ruby on Rails for the first time in his life. Don’t get me wrong, there’s nothing wrong with that, in fact I encourage everyone to choose Ruby on Rails for their personal dream or an experiment.

Problem is that this dude was hired as a super expensive contractor with tons of experience but that experience was all with different programming languages. After 6 months his contract expired and he moved on to a different project probably trying out different web…

Benito Serna 

Examples to explore possible race conditions when caching custom computed values in Rails

In Rails, sometimes you will need to save counts or custom computed values, where the default counter cache will not be enough.

Maybe you want to…

  • Update a counter cache when a value change and not only when the association is created or deleted.
  • Have a counter cache for complex “has many through” associations.
  • Keep a count for a scope of the association, like just the “positive reactions”, or the “completed orders”.
  • Cache a sum or another calculation like the “account balance”.

There are different techniques for caching this kind of values, but sometimes this type of calculation are prone to race conditions.

Here I want share a tool to help you understand why caching this kind of…

Test Double 

What I learned from pairing by default

An introduction

For the vast majority of my career, I rarely pair-programmed. I’d even tried it a couple of times, but it was awkward and clunky and slow. I wasn’t sold. It became something I only did if I or somebody else was really (really) stuck on something, but never in the regular course of things.

Then I worked with a client who practiced extreme programming and paired by default. That is, the expectation was that you didn’t work on code by yourself. Instead, you spent your day pairing with a partner. What this looked like was this:

  1. Every day at our morning huddle, everybody on the team got a buddy for the day based on:
    • What was in-progress or to-be-started
    • Who was holding…
Julia Evans 

Tips for analyzing logs

Hello! I’ve been working on writing a zine about debugging for a while now (we’re getting close to finishing it!!!!), and one of the pages is about analyzing logs. I asked for some tips on Mastodon and got WAY more tips than could fit on the page, so I thought I’d write a quick blog post.

I’m going to talk about log analysis in the context of distributed systems debugging (you have a bunch of servers with different log files and you need to work out what happened) since that’s what I’m most familiar with.

search for the request’s ID

Often log lines will include a request ID. So searching for the request ID of a failed reques will show all the log lines for that request.

This is a…

Planet Argon Blog 

Best Job Search Websites for Ruby on Rails Developer Jobs

Best Job Search Websites for Ruby on Rails Developer Jobs

In this article, we’ll share some of our favorite places to post job listings, including a few Ruby/Rails community-focused sites.

Continue Reading

Test Double 

The Best Kind of Brilliant

The Ruby community has lost a true luminary this week with the passing of Chris Seaton, staff researcher at Shopify and creator of the impressive and envelope-pushing TruffleRuby implementation. Chris and I probably met two dozen times without having a real conversation, but my friend Aaron Patterson worked with him:

As a college dropout, I’ve always felt underqualified. Embarrassment about my lack of knowledge and credentials has driven me to study hard on my own time. But Chris never once made me feel out of place. Any time I had questions, without judgement, he would take the time to explain things to me.

I’ve always looked up to Chris. I was at a bar in London with a few…

Brilliance takes many forms in this world, but this might be the…

Ruby Rogues 

Building Desktop and Mobile Video Games with DragonRuby with Amir Rajan - RUBY 572

Game Developer and CEO of DragonRuby, Amir Rajan returns to the show. He joins the rogues to talk about DragonRuby. DragonRuby is a zero dependency, cross-platform, Ruby runtime built on top of mRuby, libSDL, and LLVM. Additionally, Amir talks about how it allows you to use the Ruby language to build video games. He also shares his experiences when it comes to working with mruby.

About this Episode

  • All about DragonRuby
  • Building VR games using Ruby
  • Runtime and how it works

Sponsors


Links

Tender Lovemaking 

In Memory of a Giant

The Ruby community has lost a giant. As a programmer, I always feel as if I’m standing on the shoulders of giants. Chris Seaton was one of those giants.

I’ve been working at the same company as Chris for the past 2 years. However, I first met him through the open source world many years ago. He was working on a Ruby implementation called TruffleRuby, and got his PhD in Ruby. Can you believe that? A PhD in Ruby? I’d never heard of such a thing. My impression was that nobody in academia cared about Ruby, but here was Chris, the Ruby Doctor. I was impressed.

Patience

As a college dropout, I’ve always felt underqualified. Embarrassment about my lack of knowledge and credentials has driven…

Ruby in Source Diving on Medium 

Understanding n+1 query problems in Ruby on Rails

n+1 queries are a common problem in web application development. This common pattern (or antipattern) can degrade application performance by increasing server response times and by placing additional strain on limited database resources.

Photo by Glenn Hansen on Unsplash

However, n+1 queries are sometimes desireable, and can be used along with other design patterns to improve performance. Because this pattern can have both positive and negative effects, it’s important that developers have a good understanding of n+1 patterns and their implications in the context of their application.

This guide aims to explain n+1 queries in the context of modern Ruby on Rails web applications.

What is an…

Kevin Newton 

Advent of YARV

This blog series is about how the CRuby virtual machine works. If you’re new to the series, I recommend starting from the beginning. This post is the second of two posts about calling methods.

In yesterday’s post we talked about the send instruction. Today, we’re going to show all of the various specializations of that instruction. These specializations exist in order to provide fast implementations of common method calls. Let’s first take a look at an example of one of these specializations, then we’ll dive into the entire list.

opt_plus

The opt_plus instruction is a specialization of send that is used to implement the + operator. Like almost every one of the instructions in this post,…

The Ruby on Rails Podcast 

Episode 447: Rubyconf Mini Recap + The Rails Foundation (Brittany + Jemma + Emily)

Brittany is joined by the co-organizers of Rubyconf Mini: co-host, Jemma, and Emily Samp. The trio discussed how inclusivity was laced into the event, their futures as conference planners and the adoration of Jemma's Nana. In the back half of the episode, they discuss their expectations and reaction to the announcement of The Rails Foundation.

Show Notes & Links:

Sponsored By:

Honeybadger

Honeybadger monitors your cron jobs and services to make sure they don't silently disappear. When Honeybadger is quiet, life is…

Ruby Magic by AppSignal 

Database Performance Optimization and Scaling in Rails

Web applications usually rely heavily on databases, for the most part. And as applications grow, databases grow too. We keep scaling web servers and background workers to keep up with the heavy load. But eventually, the database needs to keep up with all the new connections from these processes.

One way to tackle this is to grow a database with an app using vertical scaling. This means adding more CPU power and memory to the database server. But this is usually slow. You might have to copy all your data to the new server and then put the application down to change the database servers that it communicates with.

This is also usually a one-way operation. You can't keep adding/removing CPU…

Rémi Mercier 

The never-ending days of DEI’s importance

A few weeks back, the creator of Ruby on Rails wrote a pamphlet rejoicing on - what appears to him as - the waning days of DEI’s dominance.

I’ll be honest my first reaction was to dunk on DHH. But a bazillion people did that already, so my thirst for name-calling was already quenched.

I decided to scrap the great title I had initially written for this post1, and engage in a more boring write-up about how diversity, equity, and inclusion were, are, and will always be essential to workers.

Disclaimer: I was a fan of 37signals for a long time. I’ve read every post ever written on their blog. I’ve listened to all their podcasts. I promoted their work philosophy within the companies I worked…

Shopify Engineering - Shopify Engineering 

Planning in Bets: Risk Mitigation at Scale

What do you do with a finite amount of time to deal with an infinite number of things that can go wrong? This post breaks down a high-level risk mitigation process into four questions that can be applied to nearly any scenario in order to help you make the best use of your time and resources available.

More

Felipe Vogel 

OOP vs. services for organizing business logic

Disclaimer: In this blog post I raise many questions and give few answers. At the bottom I list resources which I’m exploring in search of an answer, so skip down if that’s all you care about.

Business logic. Everyone has it, and no one seems to agree on where to put it in a Rails app. Some people stuff it all in Active Record models, others throw it out into service objects, and still others put it in…

Kevin Newton 

Advent of YARV

This blog series is about how the CRuby virtual machine works. If you’re new to the series, I recommend starting from the beginning. This post is the first of two posts about calling methods.

Method calls are everywhere in Ruby. Even things that don’t look like method calls are method calls. The following are all examples:

Source Receiver Method Arguments foo self foo [] foo? self foo? [] foo! self foo! [] foo.() foo call [] foo[bar] foo [] [bar] foo[bar] = baz
Ruby Magic by AppSignal 

A First Look at Hanami 2 for Ruby

As of today (06/12/2022), Hanami 2.0.1 has been released. Read more about the enhancements, bug fixes and gems in release 2.0.1.

Hanami 2 was released on 22 November, concluding four years of work on this version. It brings a breath of fresh air into Ruby's web development community. Version 2.0 is not just an incremental upgrade. One could say it's a project written anew, with bright ideas from version one rebuilt on top of a solid dry-rb libraries ecosystem.

Since there is no clear upgrade path from version 1.3, in this article, we will focus on some key aspects of the release rather than comparing the two versions.

We will take a close look at the following:

  • Slices
  • Dependency management

Let's get…

Rich Stone Input Output 

Everything I know about Elm, you really need to know this too!

Everything I know about Elm, you really need to know this too!

I heard there is Elm. I heard you can write code with it. I also heard of Elm Street and the nightmares on it (but I wished I never had). And I heard no more. I don't even know what Elm translates too, cause I'm no native speakerz (my wild guess would be that it has something to do with plants or trees).

Everything I know about Elm, you really need to know this too!

But another curious coder, Bouwe his first name, made the time to gain some experience with it!
Why? I have no idea! So there are a lot of open questions that I have for Bouwe in the coming Thursday evening, looking forward to a bunch of learning on different fronts:

https://curiouscoders.webinargeek.com/bouwe-rocks-elm

If you know anything about Elm or know someone who could know, please let…

Code with Jason 

166 - Feature Flags and Duplication with Julian Fahrer

In this episode, Julian Fahrer returns to discuss feature flags and duplication.

Janko’s Blog 

Social Login in Rails with Rodauth

OmniAuth provides a standardized interface for authenticating with various external providers. Once the user authenticates with the provider, it’s up to us developers to handle the callback and implement actual login and registration into the app. There is a wiki page laying out various scenarios that need to be handled if you want to support multiple providers, showing that it’s by no means a trivial task.

While Devise provides a convenience layer around OmniAuth, it does nothing to actually sign the user into your app. When I started writing the OmniAuth integration for Rodauth, I wanted to go one step further and actually handle things like persistence of external identities, account…

Ruby News 

Ruby 3.2.0 RC 1 Released

We are pleased to announce the release of Ruby 3.2.0-rc1. Ruby 3.2 adds many features and performance improvements.

WASI based WebAssembly support

This is an initial port of WASI based WebAssembly support. This enables a CRuby binary to be available on a Web browser, a Serverless Edge environment, or other kinds of WebAssembly/WASI embedders. Currently this port passes basic and bootstrap test suites not using the Thread API.

Background

WebAssembly (Wasm) was originally introduced to run programs safely and fast in web browsers. But its objective - running programs efficiently with security on various environment - is long wanted not only for web but also by general applications.

WA…

Hanami 

Hanami 2.0.1

Hello again, friends! We’re excited to share our release of Hanami 2.0.1!

It ships with small enhancements and minor bug fixes, after our 2.0.0 release.

Enhancements and Bug Fixes

  • Ensure Content-Security-Policy HTTP response header to be returned as a single line
  • Ensure to load .env files during CLI commands execution
  • Ensure hanami server to respect HTTP port used in .env or the value given as CLI argument (--port)
  • Ensure Rack events are on internal notifications system
  • Return HTTP response header Allow when returning 405 HTTP status
  • Introduce Hanami::Middleware::BodyParser::FormParser to parse multipart file upload
  • Make Hanami::Utils::Callbacks::Chain and …

Released Gems

  • hanami 2.0.1
  • hanami-reloader 2.0.1
  • hanami-cli 2.0.1
  • hanami-router 2.0.1
  • hanami-utils 2.0.1

How To Upgrade

How to upgrade from a Hanami app:

$ bundle update hanami-utils hanami-router hanami-cli hanami-reloader hanami

How to try Hanami for the first time:

$ gem install ha…
The Bike Shed 

364: Constructive vs Predicative Data

Stephanie and Joël attended RubyConf Mini, and both spoke there. They discuss takeaways and highlights from the conference.

The core idea for this episode is explained in this article: Constructive vs. Predicative Data. This came up recently in a conversation at thoughtbot about designing a database schema and what constraints could be encoded in the schema directly versus needing some kind of trigger or Rails validation to cover it.


This episode is brought to you by Airbrake. Visit Frictionless error monitoring and performance insight for your app stack.


RubyConf Mini
Episode on CFP - The Bike Shed 352: Case Expressions
Podcast panel: The Ruby on Rails Podcast Episode 446:…

Giant Robots Smashing Into Other Giant Robots 

Time Zones and Rocket Ships

While the physical phenomenon of time always moves forward, local time is capricious. It can jump forwards and backwards, skip some numbers entirely and repeat others. Worse still, local time changes can happen arbitrarily. This can make it really hard to work with times in the future.

Space shuttle launching into space Photo by NASA via Unsplash

Scheduling an event with absolute time

For example, let’s say the USA and EU are both launching rockets from their launchpads at Cape Canaveral, Florida and Guiana Space Center, French Guiana respectively. Both launches are scheduled for the UNIX timestamp 1637168400 so we know the two launches will happen simultaneously.

What we don’t know is what the…

Martian Chronicles, Evil Martians’ team blog 

Blend to my will! Fonts on cylinder objects in Blender

Authors: Gleb Stroganov, Product Designer, and Travis Turner, Tech EditorTopics: Design, Frontend Development, Fonts, Blender

Making an illustration for a phone input UI: rendering the shape, curving text around it, and animating it.

Each time we make an illustration, we face some unique challenge. This can be technical, creative, or perhaps even spiritual. In this article, we’ll get an over-the-shoulder look at this process and see how to model and render a metal object inspired by a classic picker UI design, and we'll tackle working with fonts in Blender—specifically, making the text curve around this cylinder-shaped object (and we’ll animate it, too!)

Test Double 

Smoother, responsive Rails forms with Tailwind

Smoother, responsive Rails forms

Recently I shared some of my struggles writing forms in standalone JavaScript UI frameworks. Forms are:

  • an inevitable reality in web development
  • cruft that we need to capture data
  • things that allow us to actually provide value to users

Re-inventing the wheel on basic concerns like validation, storing and composing form data, and persisting it means we’re losing time and energy we’d rather dedicate to more valuable features. It’s sad when we give up the elegant tools Rails gives us to quickly build out forms.

Equally, I’ve found using modern styling solutions can feel cumbersome with Rails forms. Tailwind is great, especially in a component-based UI.…

Kevin Newton 

Advent of YARV

This blog series is about how the CRuby virtual machine works. If you’re new to the series, I recommend starting from the beginning. This post is about changing object types on the stack.

There are occasions where the use of particular syntax results in the need for a specific type of object. For example, when you’re interpolating an object into a string, you need to convert the object to a string. When you’re creating a list of symbols, you need to convert the elements into symbols. There are five instructions that are used to convert objects to other types in response to syntax:

Call data

As a quick aside before we jump…

Andy Croll 

Find out what callbacks are defined on an Active Record model in the console

I was recently asked by my First #RubyFriend mentee how to list the callbacks present on an Active Record model. I didn’t know.

They were looking at a vast legacy codebase, with some large models defined across multiple files. The models used various gems, custom callbacks, and concerns. It was very hard to parse what behaviours the callbacks were causing.

I found mention of debugging callbacks in the Rails API documentation and, after a little digging, built a simple loop you can use to find the callbacks defined on an Active Record model.

Use…

…a loop in the Rails console.

Open the console.

bin/rails console

Paste this code into the console to see the user-defined callbacks on a…

Rails, PostgreSQL Performance Audit and Tuning Consultant for Hire 

Easy to Miss Way to Optimize ActiveRecord SQL Memory Usage in Rails

By default, Rails ActiveRecord executes most of the SQL queries in a non-optimal way. In this blog post, I’ll describe how to fix this issue to speed up bottlenecks and reduce memory usage.

Bloated ActiveRecord queries

Active Record empowers developers to write fairly complex database queries without understanding the underlying SQL. Unfortunately, the same ActiveRecord is a reason for the majority of the issues that I encounter while conducting my Rails performance audits. Next to the infamous N+1 calls, “bloated” queries are another common problem.

Let’s see it in action:

app/models/user.rb

class User < ApplicationRecord
  # == Schema Information
  #
  # Table name: users
  #
  #  id…
Short Ruby Newsletter 

👋 Short Ruby News - edition #21

This edition was created with the help of @adrianthedev/@adrian@ruby.social from Avo for Ruby on Rails (a friendly full-featured Rails admin panel) and @jcsrb.

You can jump directly to one of the following sections if you like:

👐 Our Community

👉 All about Code and Ruby

🧰 Gems, Libraries, and Updates

🤝 Related (but not Ruby-specific)

More content: 🎥 🎧 🗞 (articles, podcasts, videos, and newsletters)


👐 Our Community

Source: @fxn

👐 Ruby On Rails shared about Ruby scales:

Rails scales. From HELLO WORLD to The Entire World.
Source: @rails on Twitter

👐 Someone asked the following question on /r/ruby:

Source: /r/ruby

I think it is worth considering if we want to create more contents that is not only for people coming to Ruby from other languages but also…

Drifting Ruby Screencasts 

Stimulus Outlets API

Outlets let you reference Stimulus controller instances and their controller element from within another Stimulus Controller by using CSS selectors. In this episode, we look at a simple example and then refactoring some older code where we used some workarounds to communicate with other stimulus controllers.
Honeybadger Developer Blog 

Building on Reddit's API with JavaScript

Reddit is a news aggregation, communication, and discussion application. If you want to get more information about a particular topic or have a question, Reddit is the place to be. The data on Reddit are provided to the public through its API.

The Reddit API is beneficial if you want to integrate Reddit communications into your application or if you just want to use certain data on Reddit.

The aim of this tutorial is to show how you can extract article content from Reddit using the Reddit API. I will show how the results can be limited to the range of 5 to 100 results. We will also build a feature to sort the articles by either relevance or date (latest). Extraction of the data will be…

Stanko's blog 

Elden Ring

This week I finished Elden Ring, and the moment I put the controller down I felt a void as if a good friend moved to another country and I wouldn’t see them for a long time. This was the best game I have played in years. But why? On the surface it seems just like any other open-world ARPG, yet...
Kevin Newton 

Advent of YARV

This blog series is about how the CRuby virtual machine works. If you’re new to the series, I recommend starting from the beginning. This post is about creating objects from the stack.

There are many instructions that take multiple values from the top of the stack and combine them in some way. This can be done to create various primitive objects such as arrays, hashes, ranges, regular expressions, and strings.

Here are the instructions that create objects from the stack:

newarray

When an array contains values that are not known at compile-time, the array is created at runtime from the values on…

Rich Stone Input Output 

Overconsistent git commit message style

Overconsistent git commit message style

Being overly consistent with your git commits is great for your side projects and your team. For similar reasons, you are styling and formatting your code consistently (hopefully). And for the same reason, you sometimes add purposeful comments to your code.

In a recent episode of the YAGNI podcast, the speakers were bashing against these archaic rules that can be found all over the Internet:

1.  Separate subject from body with a blank line
2.  Limit the subject line to 50 characters
3.  Capitalize the subject line
4.  Do not end the subject line with a period
5.  Use the imperative mood in the subject line
6.  Wrap the body at 72 characters
7.  Use the body to explain what and why vs. how

The…

Kevin Newton 

Advent of YARV

This blog series is about how the CRuby virtual machine works. If you’re new to the series, I recommend starting from the beginning. This post is about frames and events.

Frames

Whenever YARV is executing instructions, it is executing in the context of a frame. A frame holds all of the information necessary to execute those instructions. That includes:

  • the instruction sequence that is being executed
  • a pointer to an offset into the instruction sequence that indicates the next instruction to execute
  • a pointer to an offset into the stack where this frame was created (this is known as the environment pointer)
  • a pointer to an offset into the stack that indicates where the next value…

YARV keeps a stack of frames around. Frames push a new “child” frame onto the frame stack when a new…

Rich Stone Input Output 

Getting unstuck from a rut on your software developer journey...

Getting unstuck from a rut on your software developer journey...

Feeling stuck is a rat. It makes you wanna run away from your keyboard and leave everything behind... Sometimes you feel stuck, overworked, or bored. What about creating new exciting things? Where are the users of your side projects and what about collaborations on cool projects? You might be losing the fun of being an engineer to some rat's rut...

Sometimes it's good to take a step back, relax, disconnect completely from everything, and reset.

Other times, it's actually beneficial to double up, tackle new challenges, get better at what you do, or learn something completely new.

Actually, I sometimes come back doubling up on ideas and projects after a break. Or I double up on the spot.

No…

Julia Evans 

A couple of Rust error messages

Hello!

I’ve been doing Advent of Code in Rust for the past couple of days, because I’ve never really gotten comfortable with the language and I thought doing some Advent of Code problems might help.

My solutions aren’t anything special, but because I’m trying to learn, I’ve been trying to take a slightly more rigorous approach than usual to compiler errors. Instead of just fixing the error and moving on, I’m trying to make sure that I actually understand what the error message means and what it’s telling me about how the language works.

My steps to do that are:

  1. fix the bug
  2. make a tiny standalone program reproducing the same compiler error
  3. think about it and try to explain it to…
OmbuLabs Blog 

Advanced Forms (No JavaScript!)

When working with complex forms, it's really easy to immediately start adding JavaScript to implement non-common behaviors. But there are some hidden gems in the HTML standard that allow us to do a lot of that without adding a single line of JavaScript!

Why no JavaScript?

First of all, let's see the benefits of using native features instead of JavaScript to achieve similar results:

  • The form will work as expected even if JavaScript is disabled
  • Accessibility is easier to control with attributes in native elements
  • No JavaScript code to maintain
  • No JavaScript for the browser to download/process
  • When we don't interfere with the normal form submission process, all the Rails magic "just…

Before we start, we created a sample application showing implementation examples for you to play with.

Multiple Submit Buttons

A common example of this type of form is a listing with multiple actions…

Kevin Newton 

Advent of YARV

This blog series is about how the CRuby virtual machine works. If you’re new to the series, I recommend starting from the beginning. This post is about manipulating the virtual machine stack.

Now that we’re a little more familiar with the virtual machine stack and how to push values onto it, we’ll show a couple of instructions to do manipulations such as popping, duplicating, and swapping values.

pop

To keep all of the various stack pointers valid, it’s important that frames that push values onto the stack also pop them. This instruction is the simplest version of that, in that it pops a single value off the stack and discards it.

Remote Ruby 

New Ruby versions, the Pay gem, and the new GitHub file browser

[00:03:33] We learn about a new Ruby version that came out with a CGI security fix.  


[00:04:30] Ruby 3.2.0 is supposed to come out at Christmas, there’s a Preview 3 out and we hear about a few new features happening.


[00:07:47] Chris tells us about some speed improvements with Regexp.


[00:08:58] Andrew and Jason paired with Collin and other people, and he tells us what they did with a PR in the pay Gem.


[00:12:25] Chris pulls up the Shopify Globe that shows sales per minute of people buying stuff all around the world.


[00:14:17] We hear Chris and Collin did some payments things and refactoring stuff to get ready for Black Friday. 


[00:20:08] Andrew’s tells us he’s been learning Vim, but…

Ruby on Rails 

Executive Director for Rails Foundation needed, Stimulus 3.2 and more

Hi, Wojtek here with this week’s news from the Rails world.

The Rails Foundation is hiring an Executive Director
The Rails Foundation is looking for a full-time executive director to run day-to-day operations, and implement the Rails Core Team’s mission to improve the documentation, education, marketing, and events in the Rails ecosystem.

Improve case sensitivity uniqueness validation for “citext” columns
Stop using LOWER() for case-insensitive queries on citext columns. This helps in using database indexes for searching.

Improve “transliterate” method performance
ActiveSupport::Inflector.transliterate does not need to perform any work when the string that is passed to it is already in A…

Make…

The Life of a Radar 

CSS :has selector for selects that have options

Based on a question on the Ruby AU Slack, someone wanted to know how they could make a 2nd select box appear after an option in an original select box was selected.

I worked out today that thanks to the new :has selector in CSS, you can achieve this:

See the Pen Untitled by Ryan Bigg (@ryanbigg) on CodePen.

This demo will work in most modern browsers, with the exception of Internet Explorer 11 and Firefox. Selecting from the 1st select box will make the 2nd one appear, then selecting from that makes the 3rd box appear.

Given that this feature is currently not supported in either IE11 (at all) or Firefox (without enabling a configuration flag), I would be hesitant to use it…

Saeloun Blog 

Evaluating Media queries in a Range Context

Media queries are used to apply CSS styles depending on a device’s type (such as print vs. screen) or other characteristics such as screen resolution or browser viewport width.

//apply style when the document is viewed on a screen in print preview mode
@media print {
  body {
    font-size: 10pt;
  }
}
//apply style to all screens
@media screen {
  body {
    font-size: 13px;
  }
}

For responsive web designs, we use media queries to apply styles based on the viewport width mainly using min-width and max-width.

First, let’s understand the properties max-width and min-width.

max-width: It targets the devices from width 0px to the maximum width assigned. If min-width is…

Awesome Ruby Newsletter 

💎 Issue 341 - Crystal For Rubyists

Ruby Weekly 

Let's create a basic (useful) Ruby C extension

#​631 — December 1, 2022

Read on the Web 🇺🇦

If you missed last week's issue, make sure to take a look. It was a bumper week with lots of cool stuff including a major new JRuby release, Hanami 2.0, plus an interview with the Pickaxe's newest author. Now, without further ado, on to this week..
__
Peter Cooper, your editor

Ruby Weekly

Kevin Newton's Advent of YARV — Let’s start with something incredibly advanced and work our way down :-) Kevin works at Shopify and his projects include SyntaxTree, Exreg, and contributing to YJIT. He knows his stuff, so it’s great to see him kick off a month of posts “detailing different…

Blog of WJWH 

Some tips and tricks for doing Advent of Code with Haskell

Some intermediate level tips and tricks for doing Advent of Code with Haskell.
Kevin Newton 

Advent of YARV

This blog series is about how the CRuby virtual machine works. If you’re new to the series, I recommend starting from the beginning. This post is about the virtual machine stack, and how to push values onto it.

The first thing to understand about YARV is that it is a stack-based virtual machine. This means that all values are stored on a stack, and all operations are performed on the stack. This is in contrast to a register-based virtual machine, where values are stored in registers and operations are performed on registers. The main advantage of a stack-based virtual machine is that it is easier to implement and easier to JIT compile. The main disadvantage is that it is slower than a…

Island94.org 

Liberatory accountability

From Lee Shevek’s “Is Punishment ‘Carceral Logic’?”:

…the difference between carceral logic and liberatory accountability is not the presence/lack of punishment. Rather, the difference lies in how much power the person who has done harm has. Carceral logic aims to strip them of their personal power, while liberatory accountability processes require that they take ownership of that power. That is, ultimately, what accountability is: taking responsibility for your power as well as for the consequences of your use of it. Recognizing your own agency in having made a choice that resulted in harm, facing the people you hurt, giving them answers and apologies, and claiming your ability to do…

Ruby Rogues 

The New Ruby Parser with Kevin Newton - RUBY 571

Kevin Newton works at Shopify. He is specifically assigned to the Ruby and Rails Infrastructure Team. He returns to the show to talk about building Parsers in Ruby since he is working full-time on a new Ruby parser called "Prettier Ruby Plugin”. Prettier works with the majority of editors and support different languages.  He shares his journey on how he was able to create it.  He also talks about "exreg", which is a Ruby regular expression engine that he created. 

About this Episode

  • All about Parser 
  • How Parser applies to Ruby
  • Advantages of using Parser
  • Ways to write Parsers
  • All about exreg

Sponsors


Links

Honeybadger Developer Blog 

How to Create PDFs in PHP

Portal Document Format (PDF) is among the most popular file formats today. Individuals can view, send, and receive PDF documents regardless of their operating system, hardware, or software. Thus, the contents of the PDF document will appear the same on all platforms. In this step-by-step tutorial, we will discuss how to work with PDFs in PHP.

You can access the complete code that will be used in this tutorial from this GitHub repository.

History of PDFs

Adobe introduced PDF in 1993 to allow people to share and present documents easily. Since then, PDF has become an open standard and is supported by the International Organization for Standardization (ISO). Today, PDFs have evolved to…

The RubyMine Blog : Intelligent Ruby and Rails IDE | The JetBrains Blog 

RubyMine 2022.3 Released!

RubyMine 2022.3 is now available! 

The latest version of our popular Ruby and Rails IDE is packed with improvements, including:

  • A new UI that you can enable in the settings
  • Enhanced RBS support 
  • Improvements for working with shared contexts and examples in RSpec
  • Updated navigation and structure view functionality
  • Improved remote development

Below is a brief overview of the most notable features. For a detailed description of this update, please visit our What’s New page.

New UI 

We invite you to try out the new RubyMine UI. 

It provides easy access to essential features and progressively discloses complex functionality as needed, resulting in a cleaner look and feel that is…

Ruby on Rails 

The Rails Foundation is hiring an Executive Director

The Rails Foundation is looking for a full-time executive director to run day-to-day operations and implement our mission to improve the documentation, education, marketing, and events in the Rails ecosystem.

About the work

You’ll be responsible for everything from commissioning freelance writers and video producers on new documentation and marketing materials, to organizing events such as conferences and workshops, to overseeing our social media channels, forums, and more.

The board of The Rails Foundation will work with you to set the direction and budgets for the different categories of the work. You’ll report progress to the board at regular intervals, as well as work with other…

Shopify Engineering - Shopify Engineering 

Using Server Sent Events to Simplify Real-time Streaming at Scale

The Ruby on Rails Podcast 

Episode 446: I'm Giving A Talk on Thursday (The Rubyconf Mini Podcast Panel)

Live from Providence, RI, it is the Rubyconf Mini Podcast Panel! Panelists from different community podcasts come together to discuss their experiences at the conference, field questions from the audience attendees and of course, mention their upcoming talks they were giving at the conference.

Moderated By:

Panelists:

A special thanks to the organizers of Rubyconf Mini for making this panel happen: Jemma Issroff, Emily Samp and Andy Croll.

Sponsored By:

Honeybadger

Status Pages now come…

Saeloun Blog 

Rails serializes store data as a regular hash instead of using HWIA

ActiveRecord’s store provides a simple way to store hashes in a single column, regardless of database support. This functionality is enabled by serialization. A hash is converted either into to a string or a binary format before being stored. This action is known as “dumping”. When the data is read back from the database, it is loaded and converted to a hash. Serialization is a core Ruby module provided by the Marshal library.

Let’s create a simple Rails model which uses store.

   rails g model user name:string profile:text
    invoke  active_record
    create    db/migrate/20221111115257_create_users.rb
    create    app/models/user.rb
    invoke    test_unit
    create      test/

The profile column, though a text column, is serialized as a hash. Let’s add a store accessor…

Saeloun Blog 

Pending migrations now show path instead of filename

When migrations are pending to be executed, Rails shows a warning message to users on the console. This lists the names of the pending migrations. While this is useful in single database applications, in a multi-database application migration file names may not be unique across databases.

First let’s create a dummy migration.

   rails g model blog
    invoke  active_record
    create    db/migrate/20221111115257_create_blogs.rb
    create    app/models/blog.rb
    invoke    test_unit
    create      test/models/blog_test.rb
    create      test/fixtures/blogs.yml

We will not run the migration yet.

Before

Now when we try to run the server or a test, Rails will show a warning…

DEV Community 👩‍💻👨‍💻: Brandon Weaver 

Beyond Senior - The Parable of the Sword

After a number of conversations over the past few years with several other engineers who have moved beyond senior levels into staff and principal positions I've come away with a lot of insights, many of which have seen their way to Twitter or other conversations first, but now it's time to start collecting some of those stories into this new series: Beyond Senior.

What does it mean to go beyond the senior level in an engineering organization?

That's the question we're going to be looking at throughout this series.

The Parable of the Sword

On occasion I find myself lost in the depths of YouTube on all manner of crafting videos, and there's always a set of categories I find…

Kevin Newton 

Advent of YARV

Since I started working on the YJIT team at Shopify, I’ve been learning more and more about the CRuby virtual machine known as YARV. A lot of the details of how YARV works are not well documented or the documentation is difficult to find. As such, I decided to write a series of blog posts about how YARV works internally as a Christmas present to both the Ruby community and myself. I hope that this series will help others understand how YARV works and provide a better understanding of CRuby internals. This is the blog series I wish I had had access to when I first started working on CRuby.

In theory, I’ll post a new post every morning describing different aspects of the virtual machine.…

ruby – Bibliographic Wilderness 

vite-ruby for JS/CSS asset management in Rails

I recently switched to vite and vite-ruby for managing my JS and CSS assets in Rails. I was switching from a combination of Webpacker and sprockets — I moved all of my Webpacker and most of my sprockets to vite.

  • Note that vite-ruby has smooth ready-made integrations for Padrino, Hanami, and jekyll too, and possibly hook points for integrations with arbitrary ruby, plus could always just use vite without vite-ruby — but I’m using vite-ruby with Rails.

I am finding it generally pretty agreeble, so I thought I’d write up some of the things I like about it for others. And a few other notes.

I am definitely definitely not an expert in Javascript build systems (or JS generally),…

Code with Jason 

165 - Upgrading Rails with Ernesto Tagwerker

This week Ernesto Tagwerker returns for a discussion of his work upgrading Rails apps with FastRuby, the benefits of exercise and getting outside, and the ins and outs of productized services. 

naildrivin5.com - David Bryant Copeland's Website 

Dealing with Flaky Tests

Jason Swett asked on Twitter if anyone has an app with 2000+ tests that does not have a severe flaky test problem. I have two such apps, and I want to share the lengths I’ve gone to to make the tests not flaky.

In a nutshell, you have to build and design for testability at all levels, plus ensure your tests are clear about what is the cause of a failure.

Why Are Tests Flaky?

In my experience, tests are flaky for one of three reasons:

  • Tests that use random data either allow invalid data or have implementations that make assumptions about data input
  • Tests that integrate with an uncontrollable third party (e.g. Stripe Test Mode) will not pass if anything is out of whack with the…
Test Double 

Building a linkblog with Hugo, Tailwind and Netlify

Permalink to Video 🔗

With Twitter on shaky ground, there’s a sudden interest in open social platforms and protocols as well as a return to hosting traditional web sites and blogs. But because we’ve become accustomed to low-friction publishing workflows (type a bit in a box, click Tweet), routinely writing real blog posts can feel daunting.

This video provides a brief overview of one way to organize a personal blog that’s structurally similar to daringfireball.net—allowing for short-and-sweet posts—but with modern architecture of Hugo for static site generation, Tailwind for styling, and Netlify (plus NetlifyCMS) for hosting and on-the-go…

Shopify Engineering - Shopify Engineering 

How to Export Datadog Metrics for Exploration in Jupyter Notebooks

Hanami Mastery newest episodes! 

#34 Safe gem upgrades with pessimize gem

Upgrading gems in the bigger project can become a hustle if you don't use tools like pessimize to help you deal with them safely.
Test Double 

What I learned from pairing by default

An introduction

For the vast majority of my career, I rarely pair-programmed. I’d even tried it a couple of times, but it was awkward and clunky and slow. I wasn’t sold. It became something I only did if I or somebody else was really (really) stuck on something, but never in the regular course of things.

Then I worked with a client who practiced extreme programming and paired by default. That is, the expectation was that you didn’t work on code by yourself. Instead, you spent your day pairing with a partner. What this looked like was this:

  1. Every day at our morning huddle, everybody on the team got a buddy for the day based on:
    • What was in-progress or to-be-started
    • Who was…
Code with Jason 

Modeling legacy code behavior using science

When you want to understand what a legacy program you’re working on is supposed to do, what’s your first instinct? Often it’s to look at the code.

But unfortunately legacy code is often so convoluted and inscrutable that it’s virtually impossible to tell what the code is supposed to do just by looking at it.

In these cases it may seem that you’re out of luck. But fortunately you’re not.

Modeling

Due to what philosophers call the veil of perception, direct knowledge of anything in the world is impossible. There’s very little that we can know with absolute completeness and correctness.

We don’t have knowledge about how most things work, we only have a model of how it works. A model is a…

Test Double 

The limits of Phoenix LiveView

I was recently working on a Phoenix LiveView project and we had a requirement to not write any JavaScript. This was fairly unusual to me. While Phoenix LiveView has enough tooling to help you write robust applications on its own, it’s pretty common to reach for JavaScript packages when you start doing more and more client-side work.

That said, we stuck to the requirement, and it was an interesting learning experience. I was actually surprised how much functionality we were able to implement without significant tradeoffs. LiveView works in such a way that you don’t need to write any JavaScript for most workflows. And even when you do eventually hit a point where you need JavaScript, h…

The Life of a Radar 

Hanami 2.0 Thoughts

I’ve been a fan of Hanami for a number of years now. One of my favourite apps to work on is even an open-source Hanami app! I have also been writing an ActivityPub app called “Chirper” in Hanami.

Now that Hanami 2.0 has come out, a few people have been asking me for my thoughts on this major Hanami release.

The headline is: it’s really, really fast. It’s really clean. And it’s really good if you’re building an API at the moment.

It’s currently missing opinions/support on a view layer (so no templating) and DB persistence (although the Getting Started guide does recommend a way to set it up). Hanami 2.1 is supposed to come out (in early 2023) with proper baked-in support…

Short Ruby Newsletter 

Short Ruby News - edition #20

This edition was created with the help of @adrianthedev/@adrian@ruby.social from Avo for Ruby on Rails (a friendly full-featured Rails admin panel) and @jcsrb.

You can jump directly to one of the following sections if you like:

👐 Our Community

👉 All about Code and Ruby

🧰 Gems, Libraries, and Updates

🤝 Related (but not Ruby-specific)

More content: 🎥 🎧 🗞 (articles, podcasts, videos and newsletters)


👐 Our Community

👐 Hanami 2.0 was released. Read the release notes here.

👐 Ruby versions 3.1.3, 3.0.5 and 2.7.7 are released:

Related to this, Postmodern announced that ruby-versions now support all these three versions.

👐 Jean Boussier about Ruby/Rails:

Source:
Honeybadger Developer Blog 

Working with Markdown in Python

If you use the Internet, you have surely come across the term Markdown. Markdown is a lightweight markup language that makes it very easy to write formatted content. It was created by John Gruber and Aaron Swartz in 2004. It uses very easy-to-remember syntax and is therefore used by many bloggers and content writers around the world. Even this blog that you are reading is written and formatted using Markdown.

Markdown is one of the most widely used formats for storing formatted data. It easily integrates with Web technologies, as it can be converted to HTML or vice versa using Markdown compilers. It allows you to write HTML entities, such as headings, lists, images, links, tables, and more…

Stanko's blog 

Cutting through the noise

I use writing as a tool to organize my thoughts, but lately I have started to question if that’s the right order to do things. Writing is thinking. Text is just someone’s thoughts on paper. It’s obvious that thinking has to come first, but that’s not always the case. When I sit down to write ...
Rich Stone Input Output 

8 Things I've Learned about Ruby Internals from 30 Minutes of Ruby Under the Microscope

8 Things I've Learned about Ruby Internals from 30 Minutes of Ruby Under the Microscope

OK, this will be a short one because above all I've learned that it's fine to ditch, even a great book, after half an hour. Having stopped reading the book somewhere during the first chapter.

Still, there are some nice fun facts about ruby internals that I found in this truly awesome book:

  1. ruby reads your code 3(!) times before executing it (that's an amazing fun fact to start a chapter of a book about Ruby, just FYI)
  2. the process from your file.rb to execution is:
    a. Tokenization
    b. Parsing
    c. Compilation
  3. tokenization and parsing seem to happen kind of in parallel
  4. tokenization divides your code into tokens but is agnostic to syntax
  5. tokenization relies on a huge file called parse.y that has a…
Ruby on Rails 

Disable enum methods generation, a concurrency fix and more!

Hi there, This is Greg, bringing you the latest changes in Rails.

Make sure that concurrent map usage is thread-safe This pull request changes the way a cache miss is handled. It makes it thread-safe and ensures that it’s not overwritten in the middle of execution.

Autoload ActiveModel::ValidationError This pull request adds the missing autoload call for the ValidationError in Active Model.

Execute the before_committed! callbacks on the most recent copy of the record Before this change, only the early copy of the same record (different object ids, but pointing to the same record in the database) was used to execute the callback, but it didn’t have the touch_later information.

Ensure…

Remote Ruby 

Tip Tapping Around & The Rails Foundation

[00:02:28] Jason dives right in talking about Tiptap, a text editor for the web.


[00:06:05] The controversial Twitter is brought up, as well as Reddit, Mastodon, and Ruby Social.


[00:07:04] We go back to Tiptap the database, as Jason goes in depth into active ActionText and what he’s exploring now. 

  

[00:10:28] Jason mentions Tiptap will let you send HTML and explains why he likes the flexibility, and he shares his ideas of wanting to build Ruby Objects to represent each type of node.  Andrew and Chris share their thoughts on his ideas. 


[00:14:06] Phlex comes into the discussion and Jason explains how he incorporated it.  We learn about Joel releasing a markdown renderer for Flex and…

Ruby Rogues 

How To Recession Proof Your Job - BONUS

Coupon Code: "THRIVE" for a GIANT discount 
 
 
Are you looking at all the layoffs and uncertainty going on and wondering if your company is the next to cut back? 
 
Or, maybe you're a freelancer or entrepreneur who is trying to figure out how to deliver more value to gain or retain customers? 
 
Mani Vaya joins Charles Max Wood to discuss the one thing that both of them use to more than double their productivity on a daily basis. 
 
Mani has read 1,000's of productivity books over the last several years and has formulated a methodology for getting more done, but found that he lacked the discipline to follow through on his…
Ruby Rogues 

How To Recession Proof Your Job - BONUS

Rich Stone Input Output 

A dedicated Rails Controller with custom actions for your public static pages

A dedicated Rails Controller with custom actions for your public static pages

In the last article about public static pages, we've seen the brute force approach of creating very static public pages in Rails: Just put them into the app/assets/public folder, together with your error pages, and link to them from the routes.

But what if you want to add a little tiny chunk of dynamicity to your page, and for example show
off a small sample of resources to users who haven't signed up to your page yet? Or you just want all the nice Rails helpers to be available on your "static" page.

Also, most probably you aren't a designer or you just don't have much time for creating a fresh new design for your static page. You just want to reuse your app's layout.

The challenge with public…

Awesome Ruby Newsletter 

💎 Issue 340 - Ruby concurrency is hard: how I became a Ruby on Rails contributor

Shopify Engineering - Shopify Engineering 

Our Solution for Measuring React Native Rendering Times

After Shopify went all-in on React Native, we had to find a way to confirm our mobile apps are fast. The solution is an open-source @shopify/react-native-performance library, which measures rendering times in React Native apps.

More

Ruby News 

Ruby 2.7.7 Released

Ruby 2.7.7 has been released.

This release includes a security fix. Please check the topics below for details.

This release also includes some build problem fixes. They are not considered to affect compatibility with previous versions. See the commit logs for further details.

Download

  • https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.7.tar.bz2

    SIZE: 14850886
    SHA1: dfcd86b459a9d4bbdf2d4eb82ad3476cb9820892
    SHA256: cf800820c9e69cdd31a8cdab920391f74ed935db2397a905afabd48961913658
    SHA512: 24cc772ac1b56d3bb423f1b33716f221bf534f3717a506bf8235a698f8a454db7d79d94ae9a84067153c2f737b3f8f6085f34e36cc04be0d75ae2fdd57718870
    
Ruby News 

Ruby 3.0.5 Released

Ruby 3.0.5 has been released.

This release includes a security fix. Please check the topics below for details.

This release also includes some bug fixes. See the commit logs for further details.

Download

Ruby News 

Ruby 3.1.3 Released

Ruby 3.1.3 has been released.

This release includes a security fix. Please check the topics below for details.

This release also includes a fix for build failure with Xcode 14 and macOS 13 (Ventura). See the related ticket for more details.

See the commit logs for further details.

Download

  • https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.3.tar.gz

    SIZE: 20906051
    SHA1: bd35f56a1cc1760ea582c67cbf669556dc7ae2fd
    SHA256: 5ea498a35f4cd15875200a52dde42b6eb179e1264e17d78732c3a57cd1c6ab9e
    SHA512: 550cfda2ae492312009a58316e18fd77ea92852718b37443bcd76aac84ba6694fb841fe19bf23bee099f96f5aeed9d03e77c8c02fb194e414eca5f707adbbf90
    
Ruby Weekly 

OK, this is a big week for Ruby

#​630 — November 24, 2022

Read on the Web 🇺🇦

Sorry for the attention grabbing subject but on this day of Thanksgiving for many, we also give thanks for a busy week of Ruby releases, from an all new JRuby to Hanami 2.0, plus improvements to good old irb

The fun doesn't stop there – we have an interview with the Pickaxe's new author. Who's that? Read on to find out.. 😉
__
Your editor, Peter Cooper

Ruby Weekly

Hanami 2.0: The Better, Faster, Stronger Web Framework — I love seeing new takes on classic concepts especially when they're actively maintained and used. Hanami is a great example and 2.0 represents a lot of…

Rémi Mercier 

From stained-glass master to software engineer: it starts with a mess

I often tell the story of how I became a software engineer.

What I love about this story is that it always starts with an outrageous lie:

I’ve had a pretty straightforward trajectory.

As you might realize now, I firmly believe that facts shouldn’t spoil a good story.

The reality is more mundane (and does not fit in a 30-minute interview). But now that I’m entering my fourth year as a software engineer, I can tell you the real (hi)story.

And as stories go, it starts with a pretty damn mess.

Good stories are linear.

First, let me tell you how I pitch my professional background.

I’ve had a pretty straightforward trajectory.

 

In 2004, I started working as an apprentice in…

Saeloun Blog 

Learn about tree shaking in Webpack 5

What is tree shaking?

Tree shaking is a technique used for removing the dead code from the application. It is applied for optimizing the code. Dead code is essentially code from the library which has been imported into the application unnecessarily along with the one being used. The term tree shaking was made popular by Rollup, a JavaScript module made by Rich Harris in the year 2015.

Tree shaking relies on ES2015 syntax - import and export.

Let’s say you imported a library containing 1,300 lines of code with a lot of exports and only want to use one of them. This would result in a lot of unused code being imported into the application and thereby increasing the bundle size.

How does…

The Life of a Radar 

The Gem Foundation

Today, I am excited to announce the launch of The Gem Foundation.

Its mission is assist contributors in the Ruby community in their task to further the adoption of the Ruby language, expanding the scope more broadly than just one particular web framework.

Because Ruby is more than just a single framework.

Immediately after establishment of this foundation, we have already surpassed The Rails Foundation in terms of dollars donated, as we have donated ONE SINGLE U.S. DOLLAR to Brandon Weaver, who was the first developer to get in touch with the foundation. Brandon contributes to the Ruby community by writing articles on his personal blog, and also runs the Ruby Learning Center Discord.

Th…

RubySec 

CVE-2022-4064 (dalli): Unsanitized input leading to code injection in Dalli

A vulnerability was found in Dalli. Affected is the function self.meta_set of the file lib/dalli/protocol/meta/request_formatter.rb of the component Meta Protocol Handler. The manipulation leads to injection. The exploit has been disclosed to the public and may be used. The name of the patch is 48d594dae55934476fec61789e7a7c3700e0f50d. It is recommended to apply a patch to fix this issue.
GoRails 

Black Friday 2022 Deals on GoRails, courses, and Jumpstart Pro!

It’s Black Friday again, and this is our once-a-year sale!

It’s our way of saying thanks for all your support. You've been a huge part of making GoRails a success and Collin & I can't thank you enough. 🥰

Here's what we've got going on this year:

36% off GoRails with the yearly plan - Get the deal

Get a yearly subscription to GoRails for just $144/year. That's only $12/mo to stay up-to-date with Hotwire, Rails 7, Ruby 3, and much more!

Gifting GoRails

Want to send someone the gift of GoRails? Send us a message with the name and email of the recipient and how many months you'd like to gift them. We'll send you an invoice and once it's paid we'll invite them to their account.

$50+ off…

JRuby.org News 

JRuby 9.4.0.0 Released

The JRuby community is pleased to announce the release of JRuby 9.4.0.0.

The release of JRuby 9.4 represents a leap forward to Ruby 3.1 compatibility, which would not have been possible without help from the excellent contributors in our JRuby community: @k77ch7, @PurityLake, @ahorek, @byteit101, @mrnoname1000, @edipofederle, @chadlwilson, @philr, @gtback.

A special shout out goes to Kiichi Hiromasa (@k77ch7) for submitting dozens of feature and fix PRs and to Patrick Plenefisch (@byteit101) for his work on the libfixposix-powered subspawn gem.

We plan to put out several maintenance updates in the next few…

RubySec 

CVE-2021-33621 (cgi): HTTP response splitting in CGI

cgi.rb in Ruby through 2.6.x, through 3.0x, and through 3.1.x allows HTTP header injection. If a CGI application using the CGI library inserts untrusted input into the HTTP response header, an attacker can exploit it to insert a newline character to split a header, and inject malicious content to deceive clients.
Gusto Engineering - Medium 

The Beauty of Brownfield Development

In software development, the term “greenfield project” is often used to describe a project that is built from clean slate. Greenfield projects often present an exciting opportunity for engineers for a number of reasons. However, the foil to a greenfield project is a brownfield project. A brownfield project is one where there is a feature built on top of existing code. With brownfield projects, engineers are often subject to the constraints of the current system and must find a way for their project to coexist alongside legacy code.

Advantages of Greenfield Development

  • Opportunity for new technology — With greenfield projects, engineers can freely pick the technologies that are the right fit…
Martian Chronicles, Evil Martians’ team blog 

Realtime text analysis with Word Tagger: recipe reader, part 2

Authors: Maxim Skorynin, iOS Engineer, and Travis Turner, Tech EditorTopics: Mobile, Machine Learning Development, iOS, Swift, Computer Vision

In this article, iOS developers finish off a recipe reader. Getting text from images, analyze the findings, and convert them into usable class objects with the help of Word Tagger in Create ML.

In the first part of this series, we uncovered the data requirements for creating a Word Tagger model and where to find that data. We learned about the intricacies and edge cases involved in our task of recognizing culinary recipes. After that, we wrote a script that generate a dataset, and then we trained the model. Now it’s time for the most delicious part of…

Ruby Rogues 

There's No Limit To Your Success - RUBY 570

Jesse Spevack currently works at Stripe and specializes in Ruby on Rails. He talks about his success story of shifting careers from being an Educator to a Software Engineer. Jesse returns to show to share his humble beginnings when he started out his first job in the Tech world. 


About this Episode

  • Changing Careers
  • Experience working in Stripe
  • Transitioning from working in an office to working remotely 
  • "Hello Turing World Podcast"

Sponsors


Links

Ruby Magic by AppSignal 

System Notifications with Noticed and CableReady in Rails

This article has been partly inspired by an upcoming chapter of the author's Advanced CableReady book, and tailored to fit this guest post for AppSignal.

Notifications are a typical cross-cutting concern shared by many web applications.

The Noticed gem makes developing notifications fantastically easy by providing a database-backed model and pluggable delivery methods for your Ruby on Rails application. It comes with built-in support for mailers, websockets, and a couple of other delivery methods.

We'll also examine the merits of using the CableReady gem for triggering system notifications in your Ruby on Rails application.

Let's get into it!

Prerequisites and Requirements

Every now and…

The Ruby on Rails Podcast 

Episode 445: The 2022 Holiday Gift Guide Episode (Brittany + Nick)

It's back and now a tradition! It's the Holiday Gift Guide episode where Brittany and Nick share their picks for gifts that might appeal to a developer in your life.

Brittany's Picks

Nick's Picks

Sponsored By:

Honeybadger

Honeybadger monitors your cron jobs and services to make sure they don't silently disappear. When Honeybadger is quiet, life is good. Check monitoring off your…

Saeloun Blog 

Rails adds include_seconds option to datetime_field.

Previously, to exclude seconds from datetime, we had to parse datetime using strftime.

Before

Let’s say we have a Product model and we need to show purchased_at as a date time field excluding seconds.

This is our ProductsController.

  class ProductsController < ApplicationController
    def show
      @product = Product.find(params[:id])
      render :show
    end
end

And this is how our views/products/show.html.erb would look like.

  <h1>Product Detail</h1>

  <table class="table table-hover">
  <tbody>
    <tr>
      <%= form_with model: @product do |form| %>
        <%= datetime_field("product", "purchased_at", value: @product.purchased_at.strftime("%Y-%m-%dT%H:%M")) %>
      <%…
Rich Stone Input Output 

Ditch Your Books after Half an Hour (Ruby Under A Microscope)

Ditch Your Books after Half an Hour (Ruby Under A Microscope)

Ruby Under the Microscope. I had this book for 3 years on my list. It probably drained some of my mental energy, cause I wanted to read it and devour it. It had a lot of promises they I resonated with:

  • understand the ruby programming language on a deeper level
  • dig very deep into the ruby internals and pick up some computer science on the way
  • sniff some C
  • learn from and about technical illustrations

The time finally came. I just finished a book that I devoured (Sustainable Web Development with Ruby on Rails by David Copeland). And I was pumped about the next, this golden piece that was on my list for so long.

After reading some of the first chapters I realized that I wasn't excited about the book.…

Graceful.Dev 

Black Friday Not-Sale (UPDATED)

UPDATE: The not-sale has ended, and here are the results!

A total of $835 in new purchases were made between Friday the 25th and Monday the 28th.

Thanks to you, we made donations to both UnhousedSTL and Direct Relief in the amount of $208.75.

Donation to UnhousedSTL
Donation to Direct Relief

Thank you again to everyone who participated!


From time to time people ask whether there will be a Black Friday sale on Graceful.Dev content. In the past my answer has always been “no”. Partly because I’ve historically made my annual birthday sales the center of my discount calendar. Partly because I’m usually too busy with family obligations around this time of year to think…