Skip to content

Instantly share code, notes, and snippets.

@dperrymorrow
Created April 6, 2012 17:16
Show Gist options
  • Save dperrymorrow/2321442 to your computer and use it in GitHub Desktop.
Save dperrymorrow/2321442 to your computer and use it in GitHub Desktop.
Coffeescript Singleton
class Singleton
_instance = undefined # Must be declared here to force the closure on the class
@get: (args) -> # Must be a static method
_instance ||= new _Singleton args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment