Created
July 8, 2013 21:29
-
-
Save tlevine/5952673 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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