Skip to content

Instantly share code, notes, and snippets.

View csauve's full-sized avatar
⌨️
doot doot

Connor Sauve csauve

⌨️
doot doot
View GitHub Profile
@csauve
csauve / unicode-hide.js
Created November 6, 2015 08:54
Given some ASCII input text, encodes it in the free codepoint bits of 3-byte unicode characters. Result is fewer characters but more bytes.
var TextEncoder = require("text-encoding").TextEncoder;
var TextDecoder = require("text-encoding").TextDecoder;
var jsSource = "";
process.stdin.resume();
process.stdin.on("data", function(buf) {
jsSource += buf.toString();
});
process.stdin.on("end", function() {
@csauve
csauve / gist:43bf117a31dca9808228
Created December 8, 2014 22:10
Simple map-reduce in Groovy
def mapReduce = { collection, mapper, reducer ->
collection.groupBy(mapper)
.collectEntries { k, v ->
[k, reducer(v)]
}
}
mapReduce([1, 6, 3, 7, 3, 9, 1, 2, 10, 9, 5, 8, 4],
{ it % 2 ? "odd" : "even" },
{ it.size })