Skip to content

Instantly share code, notes, and snippets.

@sugyan
Created April 3, 2012 08:06
Show Gist options
  • Save sugyan/2290368 to your computer and use it in GitHub Desktop.
Save sugyan/2290368 to your computer and use it in GitHub Desktop.
play codestre.am video on your terminal
var sio = require('socket.io-client');
var socket = sio.connect('http://play.codestre.am/?id=' + '3Y');
console.log('connecting...');
socket.on('connect', function () {
console.log('connected.');
});
socket.on("frames", function (frames) {
process.stdout.write("\x1b[2J\x1b[1;1H");
var loop = function () {
if (frames.length === 0) {
process.exit(0);
}
var obj = frames.shift();
setTimeout(function () {
process.stdout.write(obj.data);
loop();
}, obj.delta);
};
loop();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment