Skip to content

Instantly share code, notes, and snippets.

@coreyhaines
Created March 23, 2009 23:16
Show Gist options
  • Save coreyhaines/83843 to your computer and use it in GitHub Desktop.
Save coreyhaines/83843 to your computer and use it in GitHub Desktop.
@times_2_green = []
Autotest::add_hook :all_good do |at|
@times_2_green << Time.now.to_i
data = []
@times_2_green.uniq.each_with_index do |time, index|
if index > 0
data << time - @times_2_green[index-1]
end
end
if data.size > 0
File.open("test.html", "w") do |f|
f.puts "<title>Time 2 Green Graph</title>"
f.puts "<img src='http://chart.apis.google.com/chart?cht=lc&chs=250x100&chd=t:#{data.join(',')}&chds=0,#{data.max+10}' />"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment