Skip to content

Instantly share code, notes, and snippets.

@Anaphase
Anaphase / coffeescript-class-cheatsheet.coffee
Created September 21, 2015 16:36
CoffeeScript Class Cheatsheet
class ClassName
# shared via closure over constructor
# class and instance functions have access to this variable
privateVariable = 'privateVariable'
# shared via closure over constructor
# not exposed in instance
# doesn't have access to instance
# @ is the window object
var RedditStream, auth, comment_stream;
RedditStream = require('reddit-stream');
comment_stream = new RedditStream('comments', 'all', 'unique user agent for my-supercool-bot');
auth = {
username: 'my-supercool-bot',
password: 'password',
app: {