Skip to content

Instantly share code, notes, and snippets.

@andrewschaaf
Created February 26, 2011 16:24
Show Gist options
  • Save andrewschaaf/845361 to your computer and use it in GitHub Desktop.
Save andrewschaaf/845361 to your computer and use it in GitHub Desktop.
# client = ...
class User
constructor: (call_when_created) ->
m = client.multi()
m.incr "user_id"
m.get "user_id", (e, r) ->
@id = parseInt r, 10
call_when_created this
m.exec()
new User (user) ->
console.log user.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment