Skip to content

Instantly share code, notes, and snippets.

@christinac
Created July 4, 2014 21:03
Show Gist options
  • Select an option

  • Save christinac/e99a2a711ce8e8be228d to your computer and use it in GitHub Desktop.

Select an option

Save christinac/e99a2a711ce8e8be228d to your computer and use it in GitHub Desktop.
ruby -r json -r open-uri -e 'last = nil; rem_t = nil; while true; dollars=(JSON.parse(open("https://pledge.mayday.us/r/total").read)["totalCents"] - 100000000)/100; rem = 5000000-dollars; puts "$#{dollars} raised. $#{rem} to go."; (last = dollars; sleep 60; next) unless last; delta_rem_t = (rem.to_f / ((dollars - last) * 60)); rem_t = rem_t ? (0.85 * rem_t + 0.15 * delta_rem_t) : delta_rem_t; puts " $#{dollars-last} in the last 60 seconds. #{rem_t} hours to go."; last = dollars; sleep 60 ; end'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment