Created
May 5, 2016 21:40
-
-
Save ambirdsall/3070704a30ea7cd550c8c7cdc27ee302 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 ruby | |
begin | |
require 'tod' | |
require 'tod/core_extensions' | |
rescue LoadError | |
`gem install tod` | |
require 'tod' | |
require 'tod/core_extensions' | |
end | |
morning = Tod::Shift.new(Tod::TimeOfDay.new(6), Tod::TimeOfDay.new(13), true) | |
afternoon = Tod::Shift.new(Tod::TimeOfDay.new(13), Tod::TimeOfDay.new(18, 30), true) | |
evening = Tod::Shift.new(Tod::TimeOfDay.new(18, 30), Tod::TimeOfDay.new(23, 45), true) | |
night = Tod::Shift.new(Tod::TimeOfDay.new(23, 45), Tod::TimeOfDay.new(6), true) | |
now = Time.now.to_time_of_day | |
icon = if morning.include?(now) | |
'☕️' | |
elsif afternoon.include?(now) | |
'🐙' | |
elsif evening.include?(now) | |
'🍺' | |
elsif night.include?(now) | |
'🌒' | |
end | |
print icon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment