Ruby

Code Golfing Leap Years in Ruby

A work buddy challenged me to a bit of Ruby code golfing.

Write a program to print all leap years from 1800 up to and including 2400.

The website he got the challenge from (https://code.golf/leap-years#ruby) has a neat feature: it can run your code and verify whether the output matches the expected result.

I’m usually not much of a code golfer, I generally prefer writing code that’s performant and readable rather than short and cryptic, but this turned out to be a fun little challenge and even somewhat educational.

Simulating candle flickering with a simple RNG

While preparing to attach the electrical candles to the christmas tree, a question popped into my mind.

There are electrical candles that simulate the flickering of real candles. How complex would an algorithm have to be to be convincing?

I wrote a quick proof of concept in Ruby for a script running in the terminal which just randomly chooses a grey value to display.