Skip to content

Instantly share code, notes, and snippets.

@jeffdeville
Created October 31, 2011 16:36
Show Gist options
  • Select an option

  • Save jeffdeville/1327915 to your computer and use it in GitHub Desktop.

Select an option

Save jeffdeville/1327915 to your computer and use it in GitHub Desktop.
map = ->
return unless this.users instanceof Array
for user_id in this.users when !user_id.equals(current_user)
emit(user_id, {interests_in_common: 1})
reduce = (user_id, emits) ->
result = {interests_in_common: 0}
result.interests_in_common += emit.interests_in_common for emit in emits
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment