Skip to content

Instantly share code, notes, and snippets.

@tlevine
Created July 8, 2013 21:29
Show Gist options
  • Save tlevine/5952673 to your computer and use it in GitHub Desktop.
Save tlevine/5952673 to your computer and use it in GitHub Desktop.
var term = require('hypernal')()
var tablify = require('tablify').tablify
var jsonp = require('jsonp')
term.appendTo(document.body)
// style fake terminal
var termEl = term.term.element
termEl.style['font'] = '13px Monaco, mono'
termEl.style.height = '100%'
termEl.style.padding = '5px'
termEl.style['white-space'] = 'pre'
term.write('BOSTON PUBLIC LIBRARIES\n')
// fetch libraries in Boston
jsonp('http://civicapi.com/v1/bos_public_libraries/all', function(err, data) {
var rows = []
data.features.map(function(row){
if (row.properties && row.properties.properties) rows.push(row.properties.properties)
})
term.write(tablify(rows))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment