Skip to content

Instantly share code, notes, and snippets.

View sanandnarayan's full-sized avatar

Anand Narayan sanandnarayan

View GitHub Profile
@sanandnarayan
sanandnarayan / dhoni.js
Created August 23, 2013 11:44
why cant Dhone introduce himself?
// question: why cant Dhone introduce himself?
// please fix it. Make Dhoni introduce himself!
var Man = function( name ) {
this.name = name
}
Man.prototype.introduce = function() {
console.log( this.name )
}
/*
Question: Find the shortest path and distance between two cities
Roads is an array of routes between cities.
The routes are of the format [Source, Destination1, distance, Destination2, distance, etc]
That is ["kangeyam", "hosur", 19,
"faridabad", 15, "trichy", 15]
Signifies that the road betweeen
@sanandnarayan
sanandnarayan / .gitignore
Created August 27, 2012 12:59
Albers USA states
d3
.DS_Store
@sanandnarayan
sanandnarayan / make_call.rb
Created April 9, 2012 08:08
Plivo ruby make a call
require './plivohelper.rb'
#URL of the Plivo REST service
REST_API_URL = 'https://api.plivo.com/v1/'
# Sid and AuthToken
SID = 'MAJKMWIXMDQXZDCZNMEZ'
AUTH_TOKEN = 'YTNlNWI0MzZhNWQ0OGJlNmVkOTExZDgxYjIyMTU4'
#Define Channel Variable - http://wiki.freeswitch.org/wiki/Channel_Variables
extra_dial_string = "bridge_early_media=true,hangup_after_bridge=true"
@sanandnarayan
sanandnarayan / chaning.js
Created February 11, 2012 06:02
chaining in js
var chaining = function(){
this.count = 1;
this.increment = function(){
this.count++;
this.addition = function(v){
this.count += v;
this.shout = function(){
console.log("I am shouting dadad...." + this.count);
return this;
};
@sanandnarayan
sanandnarayan / gist:1253546
Created September 30, 2011 11:56 — forked from shripadk/gist:652819
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'