Skip to content

Instantly share code, notes, and snippets.

@mickey
Created September 4, 2013 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickey/6435581 to your computer and use it in GitHub Desktop.
Save mickey/6435581 to your computer and use it in GitHub Desktop.
Dashing widget to track the number of applications for the dashing widget challenge.

##Description

Dashing widget to track the number of applications for the Dashing widget challenge.

##Preview

##Dependencies

mechanize

Add it to dashing's gemfile:

gem 'mechanize'

and run bundle install.

##Usage

  1. Add the widget HTML to your dashboard
    <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
      <div data-id="widget-competition" data-view="Number" data-title="Widgets submitted">
      </div>
    </li>
  1. Add widget-competition.rb in your jobs directory.

  2. Enjoy!

require 'mechanize'
SCHEDULER.every '5m', :first_in => 0 do |job|
page = Mechanize.new.get('http://dashing.challengepost.com/submissions')
number_of_widgets_submitted = page.search(".pages").search("b").last.children.text
send_event('widget-competition', { current: number_of_widgets_submitted })
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment