Created
August 25, 2016 06:30
-
-
Save krmbzds/0e58c6a3b43f596ffc72cd2d26834c9f to your computer and use it in GitHub Desktop.
Life Percentage plugin for BitBar
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 | |
# <bitbar.title>Life Percentage</bitbar.title> | |
# <bitbar.version>v1.0</bitbar.version> | |
# <bitbar.author>Kerem Bozdaş</bitbar.author> | |
# <bitbar.author.github>krmbzds</bitbar.author.github> | |
# <bitbar.desc>Shows what percentage of life you have lived.</bitbar.desc> | |
# <bitbar.image>http://i.imgur.com/DbXIhiS.png</bitbar.image> | |
# <bitbar.dependencies>ruby</bitbar.dependencies> | |
# BitBar Life Percentage plugin | |
# by Kerem Bozdaş (@krmbzds) | |
dob = Time.new(1990, 12, 31, 10, 30, 0) # Date of birth | |
dod = Time.new(2080, 12, 31, 10, 30, 0) # Date of death (Google: life expectancy test) | |
now = Time.now() | |
percent = ((now - dob) / (dod - dob) * 100).round(2) | |
puts "❤ #{percent}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment