Skip to content

Instantly share code, notes, and snippets.

@camillebaldock
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save camillebaldock/10709a0ec6b25323f1cb to your computer and use it in GitHub Desktop.

Select an option

Save camillebaldock/10709a0ec6b25323f1cb to your computer and use it in GitHub Desktop.
Dashing Gmail widget

Description

A Dashing widget for displaying the number of emails in a Gmail inbox.

See a live demo here.

Usage

Setup the following environment variables:

  • GMAIL_USER: Gmail email address
  • GMAIL_PASSWORD: Gmail app password, see here for more information on how to generate one

Dependencies

ruby-gmail

Add it to your Dashing application's Gemfile:

gem 'ruby-gmail'

and run bundle install.

<li data-row="1" data-col="2" data-sizex="1" data-sizey="1">
<div data-id="email" data-view="Number" data-title="Email"></div>
</li>
require 'gmail'
SCHEDULER.every "30m" do
Gmail.new(ENV["GMAIL_USER"], ENV["GMAIL_PASSWORD"]) do |gmail|
send_event("email", { current: gmail.inbox.count })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment