Created
March 14, 2009 11:37
-
-
Save darashi/79051 to your computer and use it in GitHub Desktop.
札幌で開催される勉強会を抽出する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby1.9 | |
# encoding: utf-8 | |
require 'open-uri' | |
require 'rubygems' | |
require 'icalendar' | |
uri = "http://www.google.com/calendar/ical/fvijvohm91uifvd9hratehf65k%40group.calendar.google.com/public/basic.ics" | |
ics = URI(uri).read | |
cals = Icalendar.parse(ics) | |
events = cals.first.events | |
events_of_interest = events.select {|e| | |
e.summary =~ /札幌/ && (e.dtstart - DateTime.now).to_i > 0 | |
}.sort_by {|e| e.dtstart} | |
puts "Upcomming Events" | |
events_of_interest.each do |e| | |
puts "%s" % [e.dtstart.strftime('%Y年%m月%d日')] | |
puts e.summary | |
puts "at "+e.location | |
puts e.description | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment