Skip to content

Instantly share code, notes, and snippets.

@elado
elado / AngularBaseCtrl.coffee
Last active January 28, 2017 08:43
Angular.js CoffeeScript Controller Base Class
# dependency - Function.prototype.bind or underscore/lodash
app = angular.module 'someApp'
class @BaseCtrl
@register: (app, name) ->
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
app.controller name, @
@inject: (args...) ->
@liamdon
liamdon / gist:2467603
Created April 22, 2012 23:53
CoffeeScript, Jade and Stylus syntax highlighting in Sublime Text 2

Step 1: Clone the bundles into your Sublime Text packages directory

cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScript
git clone https://github.com/miksago/jade-tmbundle.git Jade
git clone https://github.com/LearnBoost/stylus.git Stylus

Step 2: Restart Sublime Text 2

@srohde
srohde / app.coffee
Created April 18, 2012 20:52
Setup Redis as Node.js Express Session Storage
express = require 'express'
RedisStore = require('connect-redis')(express)
# Heroku redistogo connection
if process.env.REDISTOGO_URL
rtg = require('url').parse process.env.REDISTOGO_URL
redis = require('redis').createClient rtg.port, rtg.hostname
redis.auth rtg.auth.split(':')[1] # auth 1st part is username and 2nd is password separated by ":"
# Localhost
else