Skip to content

Instantly share code, notes, and snippets.

@rist
Created June 8, 2010 13:47
Show Gist options
  • Save rist/430025 to your computer and use it in GitHub Desktop.
Save rist/430025 to your computer and use it in GitHub Desktop.
//RedirectionRequest is an entity within my application
setInterval(function(){
var groupedRedirectionRequests = RedirectionRequest.map(
function(){emit(this.shortUrl, 1);}
).reduce(
function(k, values){var sum = 0; for(var v in values){sum += values[v];} return sum;}
).select();
websocket.sendMessageToAllUsers(JSON.stringify(groupedRedirectionRequests));
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment