Originally a PHP hack • Inspired by XHR insolation issues • Proceeded by ugliness (codedumper.com) • Tipping point: John Resig's http://ejohn.org/apps/learn/ • Approximately 4 hours of dev to live
Förbind: how it works express socket.io mongodb ejs Tightly coupled collections listening for messages, then firing it on all open connections. Restart and it all breaks...
Pros of Node for JS Bin • CodeCasting & live reload (across all platforms) • Easy local and dependency free installs • Some code reuse, lots of knowledge reuse.
• Client saves on keypress • Server on save triggers "spike update" event with bin passed to event • Spike searches for sessions interested in that bin, and sends the updated panel
Good Side Effect • XSS recently fixed using postMessage & run.jsbin.com • IE7 doesn't support postMessage • But IE7 does LiveReload - so IE still works & securely
Dependency free •USB contains Node binaries for all platforms, code & dependancies •Saves to raw HTML files on USB stick •For teaching in strict tech environment
• Paid/donated • Alternative domain (ie. jsbin.leftlogic.com) • Each dev runs under rem.jsbin.leftlogic.com • Now we can remotely view each other's work ngrok
Upstart console log stop on shutdown respawn respawn limit 20 5 post-start script # log that we restarted logger -is -t "$UPSTART_JOB" ">>>>>>>> jsbin restart" # email the last 100 lines from the log tail -100 /var/log/upstart/jsbin.log | mail -s "ALARM: jsbin restart" [email protected] end script script set -e # make sure you only write out to /var/log/upstart/ exec sudo -u www-data PORT=8000 /usr/local/bin/node /WWW/jsbin/ 2>&1 end script https://github.com/jsbin-org/production/blob/master/apps.jsbin.com/etc/init/jsbin.conf
Sustainability: Pro • Dropbox support & live syncing • Bin playback & annotation • Sass, SCSS, smart screenshots... • Branded JS Bin's ala http://emberjs.jsbin.com