Skip to content

Instantly share code, notes, and snippets.

@akm
Created April 29, 2010 15:26
Show Gist options
  • Save akm/383764 to your computer and use it in GitHub Desktop.
Save akm/383764 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'gcalapi'
service = GoogleCalendar::Service.new("[email protected]", "*****")
calendar = GoogleCalendar::Calendar::new(service,
"http://www.google.com/calendar/feeds/[email protected]/private/full")
# 毎月18日がマイルストーン
DAY = 18
dates = {2010 => (5..12), 2011 => (1..3)}.map{|y, months| months.map{|m| Time.parse("#{y}/#{m}/#{DAY}")} }.flatten
dates.each_with_index do |d, idx|
milestone = calendar.create_event
milestone.title = "禁煙#{idx + 1}ヶ月達成!"
milestone.allday = true
milestone.st = d
milestone.en = d
milestone.save!
end
(2011..2111).each_with_index do |y, idx|
milestone = calendar.create_event
milestone.title = "禁煙#{idx + 1}年達成!"
milestone.allday = true
milestone.st = Time.parse("#{y}/04/#{DAY}")
milestone.en = milestone.st
milestone.save!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment