Skip to content

Instantly share code, notes, and snippets.

@darashi
Created March 14, 2009 11:37
Show Gist options
  • Save darashi/79051 to your computer and use it in GitHub Desktop.
Save darashi/79051 to your computer and use it in GitHub Desktop.
札幌で開催される勉強会を抽出する
#!/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