Skip to content

Instantly share code, notes, and snippets.

View aseemk's full-sized avatar

Aseem Kishore aseemk

View GitHub Profile
@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 / 1-input_.coffee
Created September 8, 2011 17:03
Streamline bug: order of precedence w/ comma operator
thing =
if id = input.id
Thing.getById id, _
else
url = adjustURL input.url
Thing.getByURL url, _
@aseemk
aseemk / 1-app.js
Created October 14, 2011 12:27
Weird/wrong order of execution when require()-ing things in Node v0.4.5
console.log(Date.now() + ' requiring coffee-script...');
require('coffee-script');
console.log(Date.now() + ' requiring streamline...');
require('streamline');
console.log(Date.now() + ' requiring custom...');
require('./custom');
@aseemk
aseemk / stack.md
Created November 21, 2011 02:19
Neo4j relationship not found error stack trace

HTTP ERROR 500

Problem accessing /db/data/ext/CypherPlugin/graphdb/execute_query. Reason:

    Relationship[17659] not found.

Caused by:

@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 '
@aseemk
aseemk / gist:2289135
Created April 3, 2012 03:45
A bookmarklet I whipped up to do something-or-another on Twitter. ;) I forget exactly what now; just didn't want to lose this code. =)
$('.tweet').each ->
$tweet = $(this)
# ignore tweets from ABC and DEF user IDs
return if $tweet.data('user-id') in [123, 456]
# also ignore tweets we've seen
return if $tweet.data('image-opened')
$openLink = $tweet.find '.open-tweet'
@aseemk
aseemk / Cakefile
Created April 22, 2012 00:56
Trying to Streamline a Cakefile
return if not require('streamline/module')(module)
task 'greet', ->
console.log 'Hello...'
setTimeout _, 1000
console.log '...world'
@aseemk
aseemk / model_.coffee
Created April 23, 2012 15:38
Streamline error: To use 'arguments' inside streamlined function, read the doc and set the 'ninja' option
module.exports = class Model
toString: (raw) ->
return super if raw
'test 1 2 3'
@aseemk
aseemk / animal.js
Created April 23, 2012 23:11
Streamline 0.2.4 super/arguments/apply bugs
/*** Generated by streamline 0.2.2 - DO NOT EDIT ***/
var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func=__rt.__func,__cb=__rt.__cb,__propagate=__rt.__propagate,__trap=__rt.__trap,__future=__rt.__future,__setEF=__rt.__setEF,__g=__rt.__g;
var Animal;
module.exports = Animal = (function() {
Animal.name = "Animal";
function Animal() {
};
Animal.prototype.greet = function Animal_prototype_greet__1(_) {
var __frame = {
@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:
#