Skip to content

Instantly share code, notes, and snippets.

@mapledyne
Last active August 29, 2015 14:24
Show Gist options
  • Save mapledyne/9ec80520ab7e19667746 to your computer and use it in GitHub Desktop.
Save mapledyne/9ec80520ab7e19667746 to your computer and use it in GitHub Desktop.
Get widget count in Dashing
require 'rubygems'
widget_count = "widget_count"
SCHEDULER.every '30s' do
widgets = Sinatra::Application.settings.history
total = widgets.length
puts "sending " + widget_count.to_s + " : " + total.to_s
send_event(widget_count.to_s, { value: total.to_i, current: total.to_s })
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment