Created
October 17, 2011 18:36
-
-
Save chrisdickinson/1293405 to your computer and use it in GitHub Desktop.
Written while waiting for tests to pass, just watchin' my ascii snail cross the screen to pass the time.
This file contains hidden or 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 snail = '@__y' | |
, progress = 0 | |
, pad = function(x) { var str = []; for(var i = 0; i < x; ++i) { str.push(' ') }; return str.join('') } | |
var interval = setInterval(function() { | |
++progress | |
progress >= 100 && | |
(progress = 0) | |
process.stdout.write('\r') | |
process.stdout.write(pad(progress)+snail+pad(100-progress)) | |
}, 400) | |
process.on('SIGINT', function() { | |
clearInterval(interval) | |
process.stdout.write('\n') | |
setTimeout(function() { process.exit() }, 0) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment