Alessandro Fazzi's Avatar

Alessandro Fazzi

@alessandrofazzi

20
Followers
94
Following
21
Posts
28.11.2024
Joined
Posts Following

Latest posts by Alessandro Fazzi @alessandrofazzi

Nicer than inline rbs?(!)

28.11.2025 15:02 👍 0 🔁 0 💬 0 📌 0

Honestly I’ve upgraded overnight and I forgot to have updated on the day after. I don’t even know what’s changed aside of some transparent things I’ve anyway never looked at before. IDE, ghostty, fish, docker and devbox are unaware of the upgrade, at least 😇

28.11.2025 15:00 👍 0 🔁 0 💬 0 📌 0

A Handful of LOLs. Thanks 🙃

02.09.2025 18:12 👍 3 🔁 0 💬 0 📌 0
A group of smiling Ruby developers gathered around a table, including Matz, the creator of Ruby!

A group of smiling Ruby developers gathered around a table, including Matz, the creator of Ruby!

The Hanami hack table at #BalticRuby was greeted by a familiar face! (And potential new user?)

13.06.2025 14:50 👍 19 🔁 6 💬 0 📌 0

All the other random guys I’d say. Keep up and thanks.

24.05.2025 11:09 👍 1 🔁 0 💬 0 📌 0

Granular or Not. It depends on the nature of the app and the stack level from where I’m raising. Deeper in the stack, more I prefer granular. Both for clarity and for spotted rescue at higher levels.

17.05.2025 15:46 👍 2 🔁 0 💬 0 📌 0
Preview
namespaces.md GitHub Gist: instantly share code, notes, and snippets.

Namespaces 101

During the last days I have done an immersion into namespaces, the new big feature that is coming in Ruby.

Here's a digested mental model for you all.

gist.github.com/fxn/86ad8584...

15.05.2025 12:03 👍 30 🔁 8 💬 5 📌 0

If you've got a blog where you (at least sometimes) write Ruby-related posts, please reply with a link to your RSS feed below.

I am going to try to start keeping an eye on those as well and sharing interesting stuff I find from time to time.

15.05.2025 23:48 👍 11 🔁 8 💬 14 📌 3

IME you just don’t. And you do it a little less for each child that comes 😂☺️

11.05.2025 21:40 👍 0 🔁 0 💬 0 📌 0

The @balkanruby.bsky.social 2025 talk recordings are now available on @rubyevents.org as well! 🙌

www.rubyevents.org/events/balka...

07.05.2025 19:54 👍 9 🔁 6 💬 0 📌 0
A screenshot of Ruby code showing the standard library's observer pattern in use. The code is as follows:

require 'observer'

class Plumber
  include Observable

  def initialize
    @coins_collected = 0
  end

  def collect_coin
    @coins_collected += 1

    # mark this object as dirty; this is required for notification to actually happen.
    changed

    notify_observers(:coin_collected, total_coins: @coins_collected)
  end
end

class AchievementEngine
  def initialize
    @hundred_coins_achievement_unlocked = false
  end

  # this will be called by notify_observers
  def plumber_updated(status, params = {})
    case status
    when :coin_collected
      plumber_collected_coin(params[:total_coins])
    end
  end

  def plumber_collected_coin(total_coins)
    puts "Collected another ten coins! Total: #{total_coins}" if (total_coins % 10).zero?

    return if total_coins < 100 || @hundred_coins_achievement_unlocked

    puts 'Achievement unlocked: collected 100 coins!'
    @hundred_coins_achievement_unlocked = true
  end
end

class Game
  def initialize
    @plumber = Plumber.new
    @achievement_engine = AchievementEngine.new

    # Register achievement engine as an observer and call `plumber_updated` on it when
    # plumber's observers are notified
    @plumber.add_observer(@achievement_engine, :plumber_updated)
  end

  # simulates some iterations of a gameplay loop, in which the plumber collects
  # a random number of coins.
  def start
    10.times do |i|
      puts "Iteration #{i.next}"
      coins_to_collect = rand(5..25)
      coins_to_collect.times.each { @plumber.collect_coin }
    end
  end
end

Game.new.start

# => Iteration 1
# => Collected another ten coins! Total: 10
# => Collected another ten coins! Total: 20
# => Iteration 2
# => Collected another ten coins! Total: 30
# < further output redacted due to alt text length constraints >

A screenshot of Ruby code showing the standard library's observer pattern in use. The code is as follows: require 'observer' class Plumber include Observable def initialize @coins_collected = 0 end def collect_coin @coins_collected += 1 # mark this object as dirty; this is required for notification to actually happen. changed notify_observers(:coin_collected, total_coins: @coins_collected) end end class AchievementEngine def initialize @hundred_coins_achievement_unlocked = false end # this will be called by notify_observers def plumber_updated(status, params = {}) case status when :coin_collected plumber_collected_coin(params[:total_coins]) end end def plumber_collected_coin(total_coins) puts "Collected another ten coins! Total: #{total_coins}" if (total_coins % 10).zero? return if total_coins < 100 || @hundred_coins_achievement_unlocked puts 'Achievement unlocked: collected 100 coins!' @hundred_coins_achievement_unlocked = true end end class Game def initialize @plumber = Plumber.new @achievement_engine = AchievementEngine.new # Register achievement engine as an observer and call `plumber_updated` on it when # plumber's observers are notified @plumber.add_observer(@achievement_engine, :plumber_updated) end # simulates some iterations of a gameplay loop, in which the plumber collects # a random number of coins. def start 10.times do |i| puts "Iteration #{i.next}" coins_to_collect = rand(5..25) coins_to_collect.times.each { @plumber.collect_coin } end end end Game.new.start # => Iteration 1 # => Collected another ten coins! Total: 10 # => Collected another ten coins! Total: 20 # => Iteration 2 # => Collected another ten coins! Total: 30 # < further output redacted due to alt text length constraints >

How would you implement the Observer pattern — similar to pub-sub — in Ruby? Well, there's a module right in the standard library that does it for you!

It's a little quirky with its dirty tracking, but that might be just what you need.

02.05.2025 11:05 👍 9 🔁 2 💬 2 📌 0

For jurists, scholars, and journalists, do take note: we have a public confession of a war crime by Vladimir Putin himself.
(Not for the first time: he also confessed to the abduction and deportation of Ukrainian children, that's why there's an international arrest warrant against him.)

26.04.2025 13:11 👍 131 🔁 51 💬 3 📌 0
Preview
Ruby data serialization options in 2025 Oj vs JSON vs MessagePack vs CBOR Introduction It had been a while since I had to look at serialization performance in Ruby. I generally would just use MessagePack for performance, and if I needed …

If you are sending schema-less data from Ruby over the wire, or if you are storing it to disk, what is your best option among the current offering?

I went through the most prominent serializers and got some interesting results

oldmoe.blog/2025/04/21/r...

26.04.2025 23:15 👍 4 🔁 4 💬 1 📌 1

I hate having drawbacks in both approaches. But most of the time getters win.

26.04.2025 07:53 👍 2 🔁 0 💬 0 📌 0

RFK Jr.'s rhetoric on autism is deeply rooted in eugenics, which at its core is a proposition that some lives are less valuable than others.

Within the last week I've heard from folks back home that I'm overreacting because I'm "one of the good ones."

The face eating leopards would like a word.

21.04.2025 05:30 👍 81 🔁 12 💬 4 📌 0

100% acc?! Just a dream for me 😋

28.03.2025 20:04 👍 0 🔁 0 💬 1 📌 0
Video thumbnail

Today I played a bit modelling multi-step workflows with #ruby, #eventsourcing and reactive UIs.
In this (ugly AF) demo, the UI reacts to state updates, which are all eventually-consistent and run in the background. No code difference between "controllers" and "background" jobs.

28.03.2025 18:08 👍 5 🔁 3 💬 1 📌 0

@andycroll.bsky.social does things other conferences say is impossible

26.03.2025 20:26 👍 7 🔁 3 💬 1 📌 0

Eloquent Ruby 2nd Edition is on the way with Pragmatic Programmers!

@russolsen.bsky.social and I have started work on modernizing this Ruby classic for the next generation of Rubyists to enjoy.

25.03.2025 15:55 👍 36 🔁 6 💬 3 📌 1

Desktop Development and Frontend Development are areas that Ruby can provide a lot of unrealized productivity in and need a lot of community help and support in.

17.03.2025 23:10 👍 1 🔁 1 💬 1 📌 0
httpclient | RubyGems.org | your community gem host

🚀 httpclient gem 2.9.0 is out! 🚀 After 8 years, we're thrilled to release this update thanks to amazing contributors! Huge thanks to yhonda & @byroot.bsky.social . 🙏
rubygems.org/gems/httpcli...

22.02.2025 01:21 👍 10 🔁 2 💬 0 📌 0

Argh! Doesn’t this hurt a bit? 😂🥲

16.02.2025 14:39 👍 2 🔁 0 💬 1 📌 0

My favorite 2024 self-reflection at work (for a self-given “expert” meaning at least). Great topic IMO.

16.02.2025 14:37 👍 0 🔁 0 💬 0 📌 0

Assuming you already know it, where will you put the demo on? :)

09.02.2025 18:08 👍 0 🔁 0 💬 1 📌 0
Preview
GitHub - ismasan/sinatra-datastar-demo: Quick demo of Sinatra and Datastar Quick demo of Sinatra and Datastar. Contribute to ismasan/sinatra-datastar-demo development by creating an account on GitHub.

Quick Sinatra demo github.com/ismasan/sina...

29.01.2025 15:17 👍 1 🔁 1 💬 0 📌 0
Updating Ruby Under a Microscope - Pat Shaughnessy

Turns out on the same day I wrote this, Pat announced the rewrite! 🤯

patshaughnessy.net/2025/1/28/up...

30.01.2025 06:11 👍 12 🔁 8 💬 1 📌 0
Post image

The EuRuKo 2024 talks are now on @rubyvideo.dev!

18.01.2025 20:04 👍 29 🔁 9 💬 1 📌 0

You’ve done a huge work so far. And not -just- by stats. It stands in front of every rubyists, I think. Thanks.

12.01.2025 20:15 👍 1 🔁 0 💬 0 📌 0
Preview
Tulsa Massacre Was a ‘Coordinated, Military-Style Attack,’ Federal Report Says The Justice Department’s conclusion follows an investigation of the 1921 atrocity in Oklahoma in which up to 300 Black residents were killed.

The Tulsa Race Massacre was not committed by an uncontrolled mob but was the result of “a coordinated, military-style attack” by white citizens, the Justice Department said in a report. It was the first time the U.S. government has given an official account of the 1921 massacre of Black residents.

11.01.2025 23:43 👍 11803 🔁 3876 💬 411 📌 271
Preview
Release RuboCop 1.70 · rubocop/rubocop New features #13474: Add new Style/ItAssignment cop to detect local assignments to it inside blocks. (@dvandersluis) #11013: Add new Lint/SharedMutableDefault cop to alert on mutable Hash defaults...

RuboCop's first release for 2025 is now out and it's huge! Version 1.70 brings a lot of bug-fixes and small improvements here and there, most notably improved integration with Shopify's ruby-lsp. Check out the release notes for more details github.com/rubocop/rubo...

Enjoy!

10.01.2025 07:51 👍 22 🔁 6 💬 0 📌 0