Skip to content

Instantly share code, notes, and snippets.

View ankurshukla's full-sized avatar

Ankur Shukla ankurshukla

View GitHub Profile
## installing gcloud SDK on Mac OS X or Linux machine
curl https://sdk.cloud.google.com | bash
## restarting shell
exec -l $SHELL
## configuring the gcloud environment
@ankurshukla
ankurshukla / singleton.js
Created August 23, 2013 17:22
Singleton Pattern in JavaScript Going over the though process of implementing the same, with a minimal to an optimized route
/*************************************************
* SINGLETON PATTERN IMPLEMENTATION *
*************************************************/
//since there are no classes in javascript, every object is technically a singleton
//if you don't inherit from it or copy from it.
var single = {};
//Singleton Implementations
//Declaring as a Global Object...you are being judged!
@ankurshukla
ankurshukla / timeout-snippet.js
Created August 23, 2013 17:19
Session Timeout Implementation in JavaScript - particularly useful for mobile and smart (hybrid) clients that have a session management implementation at the server side
/**********************************************************
* SESSION TIMEOUT IMPLEMENTATION FROM JAVASCRIPT *
* ********************************************************/
function Session() {}
Session.prototype.init = function() {
console.log('inside Session.init()');
@ankurshukla
ankurshukla / router.js
Last active December 20, 2015 21:28
basic HTTP JSON server using NodeJS. Ideal for backend data test for mobile or web UI
var test = require('./test');
function route(pathname){
var data;
pathname = pathname.substring(1, pathname.length);
switch(pathname){
case "somethingrandom" :
data = {