Skip to content

Instantly share code, notes, and snippets.

View aseemk's full-sized avatar

Aseem Kishore aseemk

View GitHub Profile
@sfate
sfate / vim-on-heroku.sh
Created June 7, 2012 14:39 — forked from naaman/vim-on-heroku.sh
vim on heroku
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
@mikekelly
mikekelly / Backbone-HAL.js.coffee
Created May 28, 2012 11:19
Two small components for making Backbone play nicely with application/hal+json
window.HAL = {}
class HAL.Model extends Backbone.Model
constructor: (attrs) ->
super @parse(_.clone attrs)
parse: (attrs = {}) ->
@links = attrs._links || {}
delete attrs._links
@embedded = attrs._embedded || {}
@aseemk
aseemk / url.coffee
Created April 27, 2012 05:51
Simplified wrapper around Node's native 'url' module
# url.coffee
# by Aseem Kishore ( https://github.com/aseemk ), under MIT license
#
# A simplified wrapper around the native 'url' module that returns "live"
# objects: updates to properties are reflected in related properties. E.g.
# updates to the `port` property will be reflected on the `host` property.
#
# The public API and behavior are pretty close to the native 'url' module's:
# http://nodejs.org/docs/latest/api/url.html Currently lacking / known issues:
#
@mikeal
mikeal / gist:2504336
Created April 27, 2012 00:11
Date parsing JSON
JSON._dateReviver = function (k,v) {
if (v.length !== 24 || typeof v !== 'string') return v
try {return new Date(v)}
catch(e) {return v}
}
JSON.parseWithDates = function (obj) {
return JSON.parse(obj, JSON._dateReviver);
}
@aseemk
aseemk / .bash_profile
Created March 29, 2012 22:24
Bash prompt hotness: Git branch, full path, bold text, newline separators. Terminal readability FTW!
# You need to have bash-completion installed, e.g. `brew install bash-completion`.
# And you may need to have git installed this way too, e.g. `brew install git`.
# This is needed for bash completion:
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
# And here's the sexy prompt that shows the Git branch for git repos:
export PS1='\n\033[1m\w$(__git_ps1 " (%s)") $\033[0m '
@rauchg
rauchg / README.md
Created March 16, 2012 21:05
~/.js/github.com.js

github.com.js

dotjs userscript for visualizing package.json files (if present) underneath the tree view.

Very useful for navigating Node.JS projects

@tj
tj / app.js
Created December 17, 2011 23:15
express 3.x cookie session middleware example
var express = require('express')
, cookieSessions = require('./cookie-sessions');
var app = express();
app.use(express.cookieParser('manny is cool'));
app.use(cookieSessions('sid'));
app.get('/', function(req, res){
req.session.count = req.session.count || 0;
@aseemk
aseemk / response.json
Created August 25, 2011 20:55
Proposed subgraph representation for Neo4j
{
"adjacencies": {
"node/1": {
"node/2": "rel/1",
"node/3": "rel/2"
},
"node/2": {
"node/4": "rel/3"
},
"node/3": {
@aseemk
aseemk / express.md
Created July 17, 2011 19:54
Express monkey-patch to properly use Node callback convention; thus supports Streamline
@aseemk
aseemk / app-dev.js
Created July 6, 2011 23:39
Handler for efficiently caching compiled Coffee and/or Streamline files.
// app-dev.js
// Helper script to register CoffeeScript and Streamline extension handlers
// before running an app during development.
//
// Uses https://github.com/aseemk/coffee-streamline for efficient require(),
// caching compiled files between runs. Sweet!
//
// Usage: instead of `_coffee app`, just do `node app-dev app`.
//
// Also works great w/ node-dev <https://github.com/fgnass/node-dev>: