Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Forked from jlord/index.js
Last active August 29, 2015 14:17
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 rwaldron/3710623b661bd7c61ff0 to your computer and use it in GitHub Desktop.
Save rwaldron/3710623b661bd7c61ff0 to your computer and use it in GitHub Desktop.

Using the existing command line gopdx node module as an easy proof of concept. I already had the module installed globally (npm install -g gopdx) and had a json of my favorite stops by id (as it requires). But in about 3 minutes I was able to turn it into a quick and dirty menubar app. ❇️

var menubar = require('menubar')
var exec = require('child_process').exec
var fs = require('fs')
var mb = menubar()
mb.on('ready', function ready () {
console.log('Ready!')
fetchTimes()
})
mb.on('show', function show () {
fetchTimes()
})
function fetchTimes () {
exec('gopdx -f', function (err, stdout, stderr) {
if (err) return console.log('ERR OH NOE')
fs.writeFileSync('index.html', '<pre>' + stdout + '</pre>')
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment