Skip to content

Instantly share code, notes, and snippets.

@sai43
Forked from theHamdiz/fridays the 13ths.rb
Created May 4, 2016 06:29
Show Gist options
  • Save sai43/c4a4a9b0294db68a21e06f5bada4c89b to your computer and use it in GitHub Desktop.
Save sai43/c4a4a9b0294db68a21e06f5bada4c89b to your computer and use it in GitHub Desktop.
Get all fridays the 13ths from now on...
require 'date'
lazy_dates = (Date.today..Date.new(9999)).lazy
fridays_the_13th = lazy_dates.select { |d| d.friday? and d.day == 13 }.first(10)
puts fridays_the_13th
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment