Skip to content

Instantly share code, notes, and snippets.

@46bit
Created November 12, 2017 04:12
Show Gist options
  • Select an option

  • Save 46bit/439fb9d721d74ade901ec99e12e93b1e to your computer and use it in GitHub Desktop.

Select an option

Save 46bit/439fb9d721d74ade901ec99e12e93b1e to your computer and use it in GitHub Desktop.
# Install these Ruby Gems (packages):
# `gem install colorize humanize`
# Call in your shell profile (e.g., ~/.zshrc):
# `ruby deadlines.rb`
require 'colorize'
require 'humanize'
require 'date'
due_date = Date.new(2017, 11, 24)
days_remaining = (due_date - Date.today).to_i
puts
puts " ###############################"
puts " NOT LONG UNTIL YORK".bold
puts " VISITING ON #{due_date}"
puts " ###############################"
puts
def bullet(prefix, n, label)
color = [:yellow, :magenta, :cyan].sample
if n.is_a? Integer
puts " # You #{prefix.bold} " + "#{n} #{label.upcase}!".bold.colorize(color)
puts " #{n.humanize} #{label}"
else
n = n.round(1)
puts " # You #{prefix.bold} " + "#{n} #{label.upcase}!".bold.colorize(color)
puts " #{n.humanize(decimals_as: :digits)} #{label}"
end
puts
end
bullet("have", days_remaining, "days remaining")
#puts " # https://www.overleaf.com/8668489vzpxktzvxtqp#/30887133/"
#puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment