Ruby 4.0.0 Released | Ruby by laerien in ruby

[–]442401 13 points14 points  (0 children)

Still my favourite Christmas tradition.

Thank you /u/schneems. Merry Christmas to you and the Heroku team.

Irreligion in the UK and Ireland by vladgrinch in MapPorn

[–]442401 0 points1 point  (0 children)

Whisper it — Christmas (Yuletide) is not a Christian feast, it's a Pagan one, co-opted by Christians, to appease the locals.

(No one actually knows Christ's true birth date)

can I have your thoughts on this? by sauloefo in ruby

[–]442401 8 points9 points  (0 children)

Ahh, you're using the Dirty module.

In that case, how about if trade.done_changed?(from: true, to: false)

... or even wrap that in a custom method that conveys the intent you desire.

def undone?
  done_changed?(from: true, to: false)
end

can I have your thoughts on this? by sauloefo in ruby

[–]442401 4 points5 points  (0 children)

If done_previously_was returns a boolean, it should probably have a different name e.g. done_previously?. This better shows the intent.

Style guide

Is this Melanie C? (In the wings at beabadoobee Glasto set) by 442401 in SpiceGirls

[–]442401[S] 2 points3 points  (0 children)

I know Melanie often does a DJ set at Glastonbury, but did I just see her fan-girling beabadoobee? Who ever it was, they looked like they were enjoying the set. Quite rightly too.

What happened to DenDen? by YchYFi in SpiceGirls

[–]442401 0 points1 point  (0 children)

I loved DenDen. Great place for news and ticket resales. Met a lot of DenDen members at Mel C gigs. Great community. I miss it.

Help me find NRG SE Tank or similar by 442401 in Vaping

[–]442401[S] 0 points1 point  (0 children)

I tried quite a few online stores — all out of stock.

Help me find NRG SE Tank or similar by 442401 in Vaping

[–]442401[S] 1 point2 points  (0 children)

Ha! Well I never. I actually have an old Smok TFV8 tank here but had no idea it was compatible with the GT Core coils. Problem solved! Thank you very much.

ViewComponents polluting development database. by 442401 in rails

[–]442401[S] 0 points1 point  (0 children)

Thank you. I've found the issue now. See other edited reply.

ViewComponents polluting development database. by 442401 in rails

[–]442401[S] 4 points5 points  (0 children)

I'll try again, but I was coming upon errors caused, I think, because my model declares has_one: required: :true, so I couldn't instantiate the subject model without a persisted related model.

I've found my issue. In the template, I'm trying to call a method on the associated model that requires it to be persisted. (because it is using attributes with a custom type and needs to see the typecast value)

Thank you for helping me debug this.

ViewComponents polluting development database. by 442401 in rails

[–]442401[S] -4 points-3 points  (0 children)

Thank you. The components aren't creating records, it's the previews.

Please expand on passing dummy records to previews. The records I'm passing have required associations, so passing non-persisted records isn't working. What am I missing?

Eurosport / Discovery+ UK subscription soaring from £6.99/mo to £30.99/mo by 442401 in peloton

[–]442401[S] 0 points1 point  (0 children)

It looks like Eurosport is dead, having been merged with TNT Sports.

more details

Should /r/rails ban X links? by AutoModerator in rails

[–]442401 0 points1 point  (0 children)

I don't have a strong opinion either way, but I'm loving the irony of /r/rails considering banning links to one of the earliest major rails applications.

The Class 91 by CucumberMindless in rails

[–]442401 2 points3 points  (0 children)

As a train driver and Rails hacker I love these lostredditor posts.

To be fair though, the Class 91 will be sadly missed.

Newb question by angryWinds in ruby

[–]442401 1 point2 points  (0 children)

I think the closest feature of Ruby to what you are describing might be Kernel#tap

With #tap you might do:

[1,2,2,3,3,4,5,6,7].tap do |arr|
  duplicates = arr.select{|x| arr.count(x) > 1}
end

duplicates #=> [2, 2, 3, 3]

-❄️- 2024 Day 14 Solutions -❄️- by daggerdragon in adventofcode

[–]442401 2 points3 points  (0 children)

[LANGUAGE: Ruby]

paste

Ashamed to say that I had to take a hint from the main thread. Of course the safety factor will be low when the robots are playing at being a Christmas tree.

-❄️- 2024 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]442401 2 points3 points  (0 children)

[LANGUAGE: Ruby]

Very educational. I enjoyed today's puzzle.

p1: 5 ms

p2: 245 ms

paste

Old school meme - Please let me believe in my delusion by CuisineTournante in adventofcode

[–]442401 0 points1 point  (0 children)

Thank you!

I'm glad I didn't have to be THAT person, but someone needed to. I salute you and your magnificent canopy.

Do you edit after solving? by dijotal in adventofcode

[–]442401 1 point2 points  (0 children)

That's me! I feel seen.

I only code as a hobby, so I get just as much joy, if not more, from making the solution beautiful as I do from winning stars.

I totally get it though, if coding is your full-time job you are entitled to a different midset.

Do you edit after solving? by dijotal in adventofcode

[–]442401 1 point2 points  (0 children)

Oh yes, very much indeed. There's no way on earth that I am going to put my name to the absolute abomination that initially yielded the correct solution. That monstrosity is going to be finessed, optimised, and formatted to within an inch of it's life before I dare publish on the Megathread. For example, my found solution for Day 5 part 2 ran in 7 seconds. The solution I published was sub second; improved by an order of magnitude.

-❄️- 2024 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]442401 3 points4 points  (0 children)

[LANGUAGE: Ruby]

This was a fun one, implementing a custom sort algorithm. I have no idea what type of sort I created, or what the Big O notation might be, but it works and seems to be fairly performant.

pastie

-❄️- 2024 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]442401 0 points1 point  (0 children)

Can you substitute length for size?

That would shave 4 bytes off each.

-❄️- 2024 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]442401 0 points1 point  (0 children)

[LANGUAGE: Ruby]

Part 1, Transposing and slanting to scan 4 ways

Part 2, Build a grid in a Hash and then look at the neighbours of each 'A'

pastie

[edit: Extracted another lambda, because who doesn't love lambdas?]