Skip to content

Instantly share code, notes, and snippets.

@yuya-maemichi-synspective
Last active May 2, 2024 11:32
Show Gist options
  • Save yuya-maemichi-synspective/af666a8ddcad04750e2bc8f07a11355f to your computer and use it in GitHub Desktop.
Save yuya-maemichi-synspective/af666a8ddcad04750e2bc8f07a11355f to your computer and use it in GitHub Desktop.
Ruby snippets
y = 2024
t0 = Time.new(y)
year_seconds = Time.new(y + 1) - t0
c = 100
c.times.map { t0 + (year_seconds / c * _1) }
y = 2024
d0 = Time.new(y)
d1 = Time.new(y+1)
year_seconds = d1.to_time - d0.to_time
(d0...d1).map{ ((_1.to_time - d0.to_time) / year_seconds) }.each{ printf "%.3f\n", _1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment