Advertisement · 728 × 90

Posts by Mads Ohm

Post image

Yup. That's a spaghetti monster alright. #adventofcode

4 months ago 3 0 0 0
Video

Happy 7th Advent of Code 🎄

4 months ago 2 0 0 0

I scored 16/21 on e-mail.wtf and all I got was this lousy text to share on social media.

7 months ago 1 0 1 0

Starting a new job today! 🥳 I'm really excited for what's to come.

7 months ago 2 0 0 0

I kept reading "na-noid" and was very confused about this new technology I had missed. 😅

"Nano ID" 😂

11 months ago 2 0 1 0

Ruby scales! It also transforms, rotates and other operations. 😂

11 months ago 1 0 0 0

Does a RuboCop cop already exist? Otherwise, I might be tempted to try and write it.

11 months ago 0 0 1 0
Advertisement
class Module - RDoc Documentation

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...)

11 months ago 1 0 1 0

$ 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`. 😅

11 months ago 1 0 1 0

Next time, I'll plan the meeting in the HOA better. 😔

1 year ago 2 0 0 0

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. 😅

1 year ago 2 0 0 0
Saving Ruby on Rails with my free UI kit – Nitro Kit for Ruby on Rails
Saving Ruby on Rails with my free UI kit – Nitro Kit for Ruby on Rails YouTube video by Mikkel Malmberg

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

1 year ago 15 1 2 1

As long as you call it 17:45.

1 year ago 5 0 1 0

Adding

require "rails_helper"

I now get

Finished in 0.22914 seconds (files took 4.91 seconds to load)
1 example, 0 failures

1 year ago 1 0 0 0

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

1 year ago 1 0 1 0

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.

1 year ago 2 0 1 0
Advertisement

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.

1 year ago 2 0 1 0

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.

1 year ago 0 0 1 0

Sure it can. Let’s just agree that the first working day in a new year always falls on a Monday. 🎉

1 year ago 4 0 0 1

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.

1 year ago 0 0 0 0

I saw the same numbers w/o YJIT just scaled down bit.

1 year ago 2 0 0 0

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.

1 year ago 1 0 1 0
Preview
Benchmarking var vs. attr vs. def Benchmarking var vs. attr vs. def. GitHub Gist: instantly share code, notes, and snippets.

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...

1 year ago 3 0 1 1

What’s the benefit here vs., for example, constants or attr_reader?

1 year ago 1 0 4 0
Advertisement

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.

1 year ago 0 0 1 0

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! 😍

1 year ago 0 0 0 0

"Friend" here is a synonym for "dad". 🫠

1 year ago 0 0 1 0

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.

1 year ago 1 0 0 0

Do you want hints, solutions, or solitude? 😅

1 year ago 0 0 0 0
Post image

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.

1 year ago 3 0 0 0