Skip to content

Instantly share code, notes, and snippets.

@raxityo
Created July 25, 2017 00:59
Show Gist options
  • Save raxityo/90d8ecb83c16dd7819b8f9e3f5333809 to your computer and use it in GitHub Desktop.
Save raxityo/90d8ecb83c16dd7819b8f9e3f5333809 to your computer and use it in GitHub Desktop.
Gob's Program. As seen in Arrested Development, Season 3 Episode 11.
const rl = require('readline').createInterface({
input: process.stdin,
output: process.stdout
})
let question =
'\033c' + // Clear screen
'\n'.repeat(process.stdout.rows - 4) + // Move prompt to the bottom
'Gob\'s Program: Y/N?\n? '
rl.question(question, (answer) => {
if (answer.trim().toLowerCase() === 'y')
setInterval(printMessage, 5)
else
rl.write('No Soup for you 😡. Oh wait!')
rl.close()
})
let cols = process.stdout.columns
var bytesWritten = 0
function printMessage() {
var message = 'Penus'
bytesWritten += 6
if(cols - bytesWritten > 6)
message += ' '
else {
message += '\n'
bytesWritten = 0
}
process.stdout.write(message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment