Skip to content

Instantly share code, notes, and snippets.

View aseemk's full-sized avatar

Aseem Kishore aseemk

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {
@aseemk
aseemk / images.css
Created May 27, 2011 18:21
Image constraining tests
h1 {
font-size: 1.5em;
font-weight: bold;
margin: 1em 0;
}
h2 {
font-size: 1.25em;
margin: 1em 0;
}
@aseemk
aseemk / mkdirp.coffee
Created June 29, 2011 08:04
My implementation of a synchronous `mkdir -p` for Node.
# synchronously creates the directory at the given path, including all
# intermediate directories, if it doesn't already exist. (like `mkdir -p`)
mkdirpSync = (dir) ->
# normalize and resolve path to an absolute one:
# (path.resolve automatically uses the current directory if needed)
dir = path.resolve path.normalize dir
# try to create this directory:
try
@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>:
@aseemk
aseemk / express.md
Created July 17, 2011 19:54
Express monkey-patch to properly use Node callback convention; thus supports Streamline
@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": {
@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;
@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

@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 '
@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);
}