Skip to content

Instantly share code, notes, and snippets.

View samarpanda's full-sized avatar
👋

Samar Panda samarpanda

👋
View GitHub Profile
@sagarpanda
sagarpanda / nodeplay.conf
Created April 18, 2014 09:28
run nodejs using upstart in ubuntu
description "nodejs server"
author "sagar - http://sagarpanda.com"
# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on started mountall
stop on shutdown
# Automatically Respawn:
respawn
@sagarpanda
sagarpanda / Class Augmentation
Last active August 29, 2015 14:07
Javascript class augmentation
What really happens when we create an object using `new` keyword
- allocate memory for the object
- Class.call(object);
- object.prototype = Class.prototype
/******* CASE 1 ********/
var Car = function(year){
this.year = year;
this.mile = 0;
this.drive = function(dist){
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "Run Query", functionName: "runQuery"} ];
ss.addMenu("HTTP Archive + BigQuery", menuEntries);
}
function runQuery() {
var projectNumber = 'httparchive';
var sheet = SpreadsheetApp.getActiveSheet();
@kracekumar
kracekumar / projects.md
Last active August 29, 2015 14:11
BangPypers dev sprint list of projects
@samarpanda
samarpanda / index.html
Last active August 29, 2015 14:17 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
function curry(fn){
@samarpanda
samarpanda / git_help.md
Last active August 29, 2015 14:17
git subtree for github page deployment

Using git subtree to push gh-pages branch or deploy project pages.

  1. Remove _site or build folder from .gitignore file.
  2. Add build directory to git traking folder or commits changes to build directory.
  3. Push changes to github gh-pages branch
# replace build_folder as appropriate  
git subtree push --prefix build_folder origin gh-pages
@samarpanda
samarpanda / README.md
Last active August 29, 2015 14:17
Data Types, Operators and Primitives

Primitive DataTypes

  1. Undefined => undefined
  2. Null => null
  3. Boolean => true
  4. String => "hello"
  5. Number => 2

Object DataTypes

  1. Object (Object can be refered as Hash as key value pairs.)
@samarpanda
samarpanda / lib.js
Created March 23, 2015 08:20
Building a quick library :)
var propMap = {
val: "value",
html: "innerHTML"
};
for(var fnName in propMap){
$.prototype[fnName] = function(prop){
return function(){
return this[prop];
}

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@samarpanda
samarpanda / autocurry.js
Created March 27, 2015 06:56
AutoCurry snippet
/**
* To Array
*/
function toArray(args) {
return [].slice.call(args);
}
/**
* Curry function
*/