Skip to content

Instantly share code, notes, and snippets.

@udzura
Created December 4, 2009 03:54
Show Gist options
  • Save udzura/248811 to your computer and use it in GitHub Desktop.
Save udzura/248811 to your computer and use it in GitHub Desktop.
Date.new(2009).enum_for(:upto, Date.new(2009, -1, -1)).select{|d| d.cwday >= 6}.to_a.map(&:to_s)
=> ["2009-01-03", "2009-01-04", "2009-01-10", "2009-01-11", "2009-01-17",
"2009-01-18", "2009-01-24", "2009-01-25", "2009-01-31", "2009-02-01", "2009-02-07",
"2009-02-08", "2009-02-14", "2009-02-15", "2009-02-21", "2009-02-22", "2009-02-28",
"2009-03-01", "2009-03-07", "2009-03-08", "2009-03-14", "2009-03-15", "2009-03-21",
"2009-03-22", "2009-03-28", "2009-03-29", "2009-04-04", "2009-04-05", "2009-04-11",
"2009-04-12", "2009-04-18", "2009-04-19", "2009-04-25", "2009-04-26", "2009-05-02",
"2009-05-03", "2009-05-09", "2009-05-10", "2009-05-16", "2009-05-17", "2009-05-23",
"2009-05-24", "2009-05-30", "2009-05-31", "2009-06-06", "2009-06-07", "2009-06-13",
"2009-06-14", "2009-06-20", "2009-06-21", "2009-06-27", "2009-06-28", "2009-07-04",
"2009-07-05", "2009-07-11", "2009-07-12", "2009-07-18", "2009-07-19", "2009-07-25",
"2009-07-26", "2009-08-01", "2009-08-02", "2009-08-08", "2009-08-09", "2009-08-15",
"2009-08-16", "2009-08-22", "2009-08-23", "2009-08-29", "2009-08-30", "2009-09-05",
"2009-09-06", "2009-09-12", "2009-09-13", "2009-09-19", "2009-09-20", "2009-09-26",
"2009-09-27", "2009-10-03", "2009-10-04", "2009-10-10", "2009-10-11", "2009-10-17",
"2009-10-18", "2009-10-24", "2009-10-25", "2009-10-31", "2009-11-01", "2009-11-07",
"2009-11-08", "2009-11-14", "2009-11-15", "2009-11-21", "2009-11-22", "2009-11-28",
"2009-11-29", "2009-12-05", "2009-12-06", "2009-12-12", "2009-12-13", "2009-12-19",
"2009-12-20", "2009-12-26", "2009-12-27"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment