TIL #ruby:

given:
`a=[1,2,3]`
as expected:
1. `a[0,3]` [1,2,3]
2. `a[3,3]` []
unexpected:
3. `a[4,4]` nil
expected behaviour on #3:
`a[4,4]` => []

As a developer who works with #Rails I'd like to reinstate that multi cultural societies work. It is just fascists who want you to believe they don't (and enact policies that attempt to derail successful co-inhabiting). Fuck this Dictator Heinemeier Hansson dude.

For 2024, I solved Advent of Code in 25 different languages. Was a fun project, sometimes a bit (very) painful (*glances at Erlang and Zig*).

Code (bottom of post) and summary for each language:
https://blog.aschoch.ch/posts/aoc-2024

Keep in mind that I used most of these language for a few hours tops, so my judgement is very much subjective.

What's your favourite of the bunch?

Today, I discovered that in #Rails 8, the command for setting up a fresh database has changed from `db:migrate` to `db:prepare`. This caught me off guard since it wasn’t mentioned in the [Rails 8.0 release notes](https://guides.rubyonrails.org/v8.0/8_0_release_notes.html#active-record).

Thankfully, I found it documented in the [ActiveRecord CHANGELOG](https://github.com/rails/rails/blob/8-0-stable/activerecord/CHANGELOG.md#rails-800beta1-september-26-2024).

However, testing migrations now requires `rails db:migrate:reset`, which feels far from intuitive.

#ruby #rails #development Had an app with complex list with erb partials. I never took the time to turn on #YJIT. But with the latest 3.4.1 release I made sure #rust was present on the system. It had >3x perf boost (not entirely fair, maybe some optimisations in the upgrade from 3.3.6 to 3.4.1). Perhaps I could have rewritten it to be more performant, but getting such improvements for 'free' is even better :D

Rails 8.0.0 is released!

https://github.com/rails/rails/releases/tag/v8.0.0

Discussions: https://discu.eu/q/https://github.com/rails/rails/releases/tag/v8.0.0

I'm doing a code challenge in Crystal. As someone who with a Ruby background who went on to learn Rust, you might think that it's a natural fit. However, I'm finding it to fall in the uncanny valley between the two - not as flexible as Ruby and not as expressive a type system as Rust, and the two play off of each other when I'm trying to do type gymnastics to get this very Ruby-like language to behave like Ruby.

shamelessly promoting my @rubyconf talk~

I love how enumeration can be customized in Ruby ❤️

Did you know you can write your own Enumerator helpers, like `.with_index` and `.with_object`?

I searched the web, and informations on this is relatively scarce.

So here's a few paragraphs to show how useful it can be! ➡️ https://kemenaran.winosx.com/posts/ruby-crafting-enumerator-helpers