Skip to content

Instantly share code, notes, and snippets.

@chrisdickinson
Created October 17, 2011 18:36
Show Gist options
  • Save chrisdickinson/1293405 to your computer and use it in GitHub Desktop.
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.
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