Skip to content

Instantly share code, notes, and snippets.

@felixrabe
Created September 14, 2013 08:53
Show Gist options
  • Save felixrabe/6560250 to your computer and use it in GitHub Desktop.
Save felixrabe/6560250 to your computer and use it in GitHub Desktop.
nsum
#!/usr/bin/env coffee
byline = require 'byline' # v. 3.1.2
stream = byline process.stdin
sum = 0
stream.on 'data', (line) ->
sum += parseInt line
stream.on 'end', ->
console.log sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment