Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cncolder/334792 to your computer and use it in GitHub Desktop.
Save cncolder/334792 to your computer and use it in GitHub Desktop.
Exec in TextMate. Product an .ics format that loop 'summary' from 'start' to 'days'.
require 'date'; start,days,summary = DateTime.new(2010,1,1),76,'到'; puts %{BEGIN:VCALENDAR\nPRODID:-//Google Inc//Google Calendar 70.9054//EN\nVERSION:2.0\nCALSCALE:GREGORIAN\nMETHOD:PUBLISH\nX-WR-TIMEZONE:UTC\nX-WR-CALDESC:}; days.times { puts %{BEGIN:VEVENT\nDTSTART;VALUE=DATE:#{start.strftime('%Y%m%d')}\nDTEND;VALUE=DATE:#{start = start.next; start.strftime('%Y%m%d')}\nSUMMARY:#{summary}\nEND:VEVENT} }; puts %{END:VCALENDAR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment