Skip to content

Instantly share code, notes, and snippets.

@charlespeach
Last active August 29, 2015 14:02
Show Gist options
  • Save charlespeach/c5ba22ef813459f36b48 to your computer and use it in GitHub Desktop.
Save charlespeach/c5ba22ef813459f36b48 to your computer and use it in GitHub Desktop.
My feeble attempt to extort a New Zealand visit from @deadmau5 on his next tour using PRINT TORTURE
# Hey @deadmau5, @nz_cub3y here. Wrote this for you.
#
# Running instructions
# ruby come_to_nz_deadmau5.rb
# You can stop the process from running any time using Ctrl+C
# Tour setup
class Tour
attr_accessor :year, :locations
def initialize(year, locations)
@year = year
@locations = locations
end
def is_coming_to?(location_name)
locations.map(&:name).include?(location_name)
end
end
class TourLocation
attr_accessor :name
def initialize(name)
@name = name
end
end
# Initial seed data
tour_locations = []
# Got lazy, so just added the two most likely tour locations? Derp.
[
'USA',
'Canada'
].each{|location| tour_locations << TourLocation.new(location)}
deadmau5_2014_tour = Tour.new(2014, tour_locations) # wooo tour!
# but.. no confirmed date in NZ yet? Will have to resort to PRINT TORTURE!
until deadmau5_2014_tour.is_coming_to?('New Zealand')
puts 'Please come back to New Zealand, Deadmau5!'
puts "- Only you can put a stop to the TORTURE by adding 'New Zealand' to the tour locations!"
# its like chinese water torture!
# when will it print next?!?!
# in 1 second, or 10? who knows, IM A CRAZY PERSON!
sleep rand(10)
end
puts 'Thank you good sir! See you soon!' if deadmau5_2014_tour.is_coming_to?('New Zealand')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment