-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c6d171d
commit 2d77347
Showing
36 changed files
with
156 additions
and
139 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
var through = require('through'); | ||
var through2 = require('through2'); | ||
var split = require('split'); | ||
var combine = require('stream-combiner'); | ||
var offset = Number(process.argv[2]); | ||
|
||
var tr = combine(split(), through(write)); | ||
process.stdin.pipe(tr).pipe(process.stdout); | ||
|
||
function write (line) { | ||
this.queue(line.replace(/[A-Za-z]/g, function (s) { | ||
function write (line, _, next) { | ||
this.push(line.replace(/[A-Za-z]/g, function (s) { | ||
var c = s.charCodeAt(0); | ||
return String.fromCharCode( | ||
c < 97 | ||
? (c - 97 + offset) % 26 + 97 | ||
: (c - 65 + offset) % 26 + 97 | ||
); | ||
}) + '\n'); | ||
next(); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
var duplexer = require('duplexer'); | ||
var through = require('through'); | ||
var through = require('through2').obj; | ||
|
||
module.exports = function (counter) { | ||
var counts = {}; | ||
var input = through(write, end); | ||
return duplexer(input, counter); | ||
|
||
function write (row) { | ||
function write (row, _, next) { | ||
counts[row.country] = (counts[row.country] || 0) + 1; | ||
next(); | ||
} | ||
function end (done) { | ||
counter.setCounts(counts); | ||
done(); | ||
} | ||
function end () { counter.setCounts(counts) } | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
var through = require('through'); | ||
var fs = require('fs'); | ||
|
||
module.exports = function () { | ||
var stdin = fs.createReadStream(__dirname + '/input.html'); | ||
stdin.pause(); | ||
stdin; | ||
return { args: [], stdin: stdin, long: true }; | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
var trumpet = require('trumpet'); | ||
var through = require('through'); | ||
var through = require('through2'); | ||
var tr = trumpet(); | ||
|
||
var loud = tr.select('.loud').createStream(); | ||
loud.pipe(through(function (buf) { | ||
this.queue(buf.toString().toUpperCase()); | ||
loud.pipe(through(function (buf, _, next) { | ||
this.push(buf.toString().toUpperCase()); | ||
next(); | ||
})).pipe(loud); | ||
|
||
process.stdin.pipe(tr).pipe(process.stdout); |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.