Mads Ohm
ohm.codes
Mads Ohm
@ohm.codes
Mostly using Ruby to put 0️⃣s and 1️⃣s in the wrong order.
I scored 16/21 on e-mail.wtf and all I got was this lousy text to share on social media.
August 18, 2025 at 6:50 AM
I kept reading "na-noid" and was very confused about this new technology I had missed. 😅

"Nano ID" 😂
May 9, 2025 at 1:07 PM
Ruby scales! It also transforms, rotates and other operations. 😂
May 8, 2025 at 9:16 AM
Does a RuboCop cop already exist? Otherwise, I might be tempted to try and write it.
April 25, 2025 at 9:04 PM
I thought you meant that you prefer

```
def prefix
@ prefix
end

def prefix=(value)
@ prefix = value
end
```
😂

Using `attr_reader`, `attr_writer`, `attr_accessor` or even `attr` seems like a good choice! Note that some forms of `attr` are deprecated (ruby-doc.org/3.4.1/Module...)
class Module - RDoc Documentation
ruby-doc.org
April 25, 2025 at 9:22 AM
$ bin/rails test

Finished in 0.000218s, 0.0000 runs/s, 0.0000 assertions/s.
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips

In all fairness, I did just do a `rails new`. 😅
April 23, 2025 at 7:19 AM
Next time, I'll plan the meeting in the HOA better. 😔
March 5, 2025 at 1:10 PM
I haven't relapsed into Magic, but Disney's Lorcana is nice too. I repeatedly "fell" on a purchase button and accidentally spent ~$1500 over a couple of months. 😅
February 19, 2025 at 8:26 AM
As long as you call it 17:45.
February 14, 2025 at 7:13 AM
Adding

require "rails_helper"

I now get

Finished in 0.22914 seconds (files took 4.91 seconds to load)
1 example, 0 failures
February 6, 2025 at 1:08 PM
We use RSpec. I've created a new file with

RSpec.describe do
it "works" do
expect(true).to eq(true)
end
end

and get

Finished in 0.00231 seconds (files took 0.1367 seconds to load)
1 example, 0 failures
February 6, 2025 at 1:08 PM
The filepath for the JSON file wasn't updated when reorganizing the code. We would have to update that e.g. using relative paths or an absolute path from the root folder.
February 6, 2025 at 9:54 AM
I see the same error (rand(1..5) gives a number between 1 and 5, but the grid is 0-indexed) for both x and y, which will surface in two different ways. If x = 5, you'll get a row with 6 entries, since you'll add the 5 index. If y = 5, you'll get a NoMethodError, since there's no row present at 5.
January 9, 2025 at 7:17 PM
What's the use case? You can already call `x` and `y` as a method on your `Point` class, where `z` will raise an `NoMethodError`. So, you can use `send` (or `public_send`) with your method name.
January 8, 2025 at 1:21 PM
Sure it can. Let’s just agree that the first working day in a new year always falls on a Monday. 🎉
January 3, 2025 at 4:37 PM
I was a bit confused at first, since “i“ usually denotes the imaginary number (squareroot of negative 1), but yeah, the sum of the first 9 (10, if you count from 0) cubes equals 2025.
January 2, 2025 at 9:12 PM
I saw the same numbers w/o YJIT just scaled down bit.
December 31, 2024 at 2:34 PM
For sure they are fast. I was expecting to see a little better performance from variables, but not much in this small test. 😅 So, yeah, my mental model, too, is that Ruby methods are fast.
December 30, 2024 at 9:49 PM
I actually thought the def-solution would be a bit slower than instance variables, since Ruby has to traverse the call tree to see where to call the method, but they seem same-ish: gist.github.com/omegahm/9bfb...
Benchmarking var vs. attr vs. def
Benchmarking var vs. attr vs. def. GitHub Gist: instantly share code, notes, and snippets.
gist.github.com
December 30, 2024 at 9:16 PM
What’s the benefit here vs., for example, constants or attr_reader?
December 30, 2024 at 7:37 PM
I've never thought about _not_ committing Gemfile.lock. I guess you'd need a tighter Gemfile. Do you have dependabot (or similar) set up to monitor your Gemfile and try to update the dependencies? That would give you a PR where the failure comes from, but would ultimately still fail on main.
December 30, 2024 at 7:14 PM
I have it on my shelf as well, but haven't had the time to actually play yet. I've only heard good things about it! 😍
December 30, 2024 at 8:39 AM
"Friend" here is a synonym for "dad". 🫠
December 27, 2024 at 7:01 PM