Skip to content

Instantly share code, notes, and snippets.

@jhs
Last active January 1, 2016 09:59
Show Gist options
  • Save jhs/8128835 to your computer and use it in GitHub Desktop.
Save jhs/8128835 to your computer and use it in GitHub Desktop.
Next CouchDB changes feed project

Followers - The next-best thing to electroshock therapy.

Followers is a library to follow CouchDB changes feeds. In fact, the API is 100% identical to Follow, with a few differences.

  • Instead of a Feed class, there is a Socialist class
  • Instead of a "change" event, Followers emits a "socialist" event
  • Change objects do not have a .changes field, but rather a .socialists field.

There are many sorts of followers. Thus, followers also supports alternative event and field names

  • Nazi class, "nazi" events, .nazis fields
  • Commy class, "commy" events, .commies fields

Background

Read out the following code to yourself.

feed.on('change', function(change) {
  var id = change.id
  var changes = change.changes

  do_changes(changes, function(er) {
    if(er)
      return callback(er)

    cha_cha_cha_cha_changes("Turn and face the stranger", function(er) {
      if(er)
        return callback(er)

      cha_cha_changes("Don't want to be a richer man")
    })
  })
})

Seriously. Me and Jarrett have been using Follow all week and we cannot get David Bowie out of our heads. It's like a horrible acid trip, but you can't even get off. You have to be stone sober and write code.

Followers solves this problem by providing the same utility as Follow but with words that do not sound like any Bowie songs; nor do they sound like Yankee rapper Tupac Shakur.

Dedication

Followers is dedicated to our socialist president, Barack Obama, and to all his followers. Sorry, Mr. Muslim: CouchDB provides all the change I believe in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment