Skip to content

Instantly share code, notes, and snippets.

View samarpanda's full-sized avatar
👋

Samar Panda samarpanda

👋
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.8.0/ramda.min.js"></script>
<script src="http://looprecur.com/hostedjs/pointfree.browser.js"></script>
<script src="http://looprecur.com/hostedjs/monoids.js"></script>
<script src="http://looprecur.com/hostedjs/maybe.js"></script>
@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];
}
@samarpanda
samarpanda / first_class_function.js
Created March 23, 2015 08:27
JS has 1st Class Functions
/**
* Why we call javascript as a first class functions
*/
// Create a function
var square = function(x){
return x*x;
};
// Return a function
@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.)

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
*/
@samarpanda
samarpanda / node-http-shell.conf
Created April 12, 2015 07:02
Adding upstart configuration to start a node service
description "app/http_server.js"
author "Samar - http://samarpanda.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
@samarpanda
samarpanda / Loggly_architecture.md
Last active August 29, 2015 14:19
Loggly architecture to be deployed in pixel server

High level architecture

Loggly Architecture

To explain this architecture i have considered nginx as the webserver. For this version we haven't used S3. We might implement that in future as per the usage.

Techops help in setting below configurations

  1. Setting a sub domain.
  2. Run the node application as a service. Advised to use systemd to create the service.

Facebook style of injecting js file

<div id="km-root"></div>
<script>(function(d, s, id) {
  var js, kjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//cdn.atomex.net/static/js/pxs/6701/ast.js";
 kjs.parentNode.insertBefore(js, kjs);
@samarpanda
samarpanda / README.md
Last active August 29, 2015 14:19
Managing Node configuration dev / prod

Managing Node configurations dev / prod

Running development code

node app.js
## dev
## 1

Running produciton code