Skip to content

Instantly share code, notes, and snippets.

@ambirdsall
Created May 5, 2016 21:40
Show Gist options
  • Save ambirdsall/3070704a30ea7cd550c8c7cdc27ee302 to your computer and use it in GitHub Desktop.
Save ambirdsall/3070704a30ea7cd550c8c7cdc27ee302 to your computer and use it in GitHub Desktop.
#! /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