joho / absurd-time-extensions

Added some stupid extensions to the time class, such as the swatch "internet time", and the is_beer_oclock? method

This URL has Read+Write access

joho (author)
Mon Jun 30 21:03:20 -0700 2008
commit  fde05d981bef64ba70df7b01b7234f298f510326
tree    75547db9c7d0d6ac7c810363e6b7b337f7e7be0f
parent  7efedc6a7dcc85b97d2c848a55ec535dbc8f728a parent  3029267cae50df863ffc273bfe3e44c3e297ec29
absurd-time-extensions / time_ext.rb
9bf5db19 » joho 2008-06-30 Putting in a few classics, ... Comment 1 class Time
2 # stupid swatch and their dotcom boom digital wristwatches
3 def to_beats
d2ca0a4a » joho 2008-06-30 removing redundant splatted... 4 seconds, minutes, hours = getutc.to_a
9bf5db19 » joho 2008-06-30 Putting in a few classics, ... Comment 5 (((hours + 1) * 3600 + (minutes * 60) + seconds) / 86.4).to_i
6 end
961fdfea » joho 2008-06-30 adding an alias for interne... 7 alias to_internet_time to_beats
9bf5db19 » joho 2008-06-30 Putting in a few classics, ... Comment 8
9 def is_beer_oclock?
10 true
11 end
12
13 # handling the vanilla ice/mc hammer event
14 attr_accessor :white_rapper
15 def stop!
16 if white_rapper
17 "collaborate and listen"
18 else
19 "Hammertime!"
20 end
21 end
569dae21 » joho 2008-06-30 adding in a check to see if... 22
23 def is_skynet_self_aware?
24 # i am assuming as skynet is pretty clever, it's on UTC
25 self > Time.utc(1997, 8, 29, 2, 14)
26 end
474ff932 » clinton 2008-06-30 Marty McFly Extension 27
28 def eighty_eight_miles_per_hour
29 Time.utc(1955, 11, 5)
30 end
2ade1831 » Gareth Townsend 2008-06-30 Added is_it_christmas? so t... 31
32 def is_it_christmas?
33 (self.month == 12) && (self.day == 25)
34 end
7efedc6a » joho 2008-06-30 added a very important calc... 35
36 def sleeps_until_christmas
37 Time.local(self.year, 12, 25).yday - self.yday
38 end
3029267c » justinfrench 2008-06-30 is it time for a coffee? 39
40 # 3pm is my coffee cut-off point every day
41 def coffee?(cutoff_hour = 15)
42 self.hour < cutoff_hour
43 end
44
7efedc6a » joho 2008-06-30 added a very important calc... 45 end
fde05d98 » joho 2008-06-30 Merge commit 'justinfrench/... 46