Yup. That's a spaghetti monster alright. #adventofcode
Posts by Mads Ohm
Happy 7th Advent of Code 🎄
I scored 16/21 on e-mail.wtf and all I got was this lousy text to share on social media.
Starting a new job today! 🥳 I'm really excited for what's to come.
I kept reading "na-noid" and was very confused about this new technology I had missed. 😅
"Nano ID" 😂
Ruby scales! It also transforms, rotates and other operations. 😂
Does a RuboCop cop already exist? Otherwise, I might be tempted to try and write it.
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...)
$ 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`. 😅
Next time, I'll plan the meeting in the HOA better. 😔
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. 😅
Saving Ruby on Rails with my free UI Kit, Nitro Kit. The reason, a brief introduction and some hope for the future.
With a guest appearance by DHH (un-paid actor.)
On PapayaTube youtu.be/Li-RPk561l8
As long as you call it 17:45.
Adding
require "rails_helper"
I now get
Finished in 0.22914 seconds (files took 4.91 seconds to load)
1 example, 0 failures
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
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.
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.
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.
Sure it can. Let’s just agree that the first working day in a new year always falls on a Monday. 🎉
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.
I saw the same numbers w/o YJIT just scaled down bit.
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.
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...
What’s the benefit here vs., for example, constants or attr_reader?
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.
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! 😍
"Friend" here is a synonym for "dad". 🫠
Yeah, I totally agree. I even think the name is bad. "endless", of course, means "without end", so it makes sense, but to me, I read "endless" as "infinite", which these methods (hopefully) are not.
Do you want hints, solutions, or solitude? 😅
Visualization (part of) of the full adders from Day 24 of Advent of Code. I generated it with Ruby (github.com/omegahm/adve...) and copy-pasted it into dreampuf.github.io/GraphvizOnli... to render i online.