Skip to content

Instantly share code, notes, and snippets.

@barrycarey
Last active March 21, 2016 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barrycarey/4172015b6dfd5dd57dd7 to your computer and use it in GitHub Desktop.
Save barrycarey/4172015b6dfd5dd57dd7 to your computer and use it in GitHub Desktop.
Something
// This can take a long time to run. It emits each result as it finds it.
findMatches.prototype.find = function(hash) {
console.log('Searching for hash: ' + hash);
for (var i=0; i < hashes.length; i++) {
if (hamming(hash, hashes[i].hash) < 10) {
console.log('emiiting match');
this.emit('found-match', hashes[i]);
}
}
};
finder.find(msg) // This is hanging the server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment