Skip to content

Instantly share code, notes, and snippets.

{
"bufopts":
{
"completefunc": "ActualVimComplete"
},
"enabled": true,
"large_file_disable":
{
"bytes": 52428800,
"lines": 50000
call plug#begin('~/.vim')
Plug 'pangloss/vim-javascript'
Plug 'groenewege/vim-less'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'scrooloose/syntastic'
Plug 'flazz/vim-colorschemes'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' }
Plug 'vim-airline/vim-airline'
@ravindersahni
ravindersahni / form_reference.html
Created December 13, 2014 04:49
Basic HTML Form Reference
<form action="/" method="POST">
<fieldset>
<legend>First Main Group</legend>
<p>
<label for="textdemo">Text:</label>
<input type="text" id="textdemo"/>
</p>
<p>
<label for="pwddemo">Password:</label>
@ravindersahni
ravindersahni / trampoline.js
Created October 8, 2014 01:06
Trampoline - Adapted from Functional JavaScript (M. Fogus)
function trampoline(fn) {
var result = fn
while (result instanceof Function) {
result = result()
}
return result
}
function isEven(n) {
@ravindersahni
ravindersahni / singleton_k_combinator.js
Last active August 29, 2015 14:07
Singleton Factory with K Combinator
function k(value) {
return function inner() {
return value
}
}
var createSingleton = k({})
, neo = createSingleton()
, mrAnderson = createSingleton()
@ravindersahni
ravindersahni / singleton_factory.js
Last active August 29, 2015 14:07
Singleton Factory with Explicit Closure
function singletonFactory() {
var neo = { skills : [] }
return function() { return neo }
}
var createSingleton = singletonFactory()
, neo = createSingleton()
, mrAnderson = createSingleton()
@ravindersahni
ravindersahni / method_lookup.js
Last active August 29, 2015 14:07
Method Lookup with Action Object (Alternative to Switch)
function doAction(action) {
var actions =
{ 'push' : function() { return 'push' }
, 'pull' : function() { return 'pull' }
, 'fork' : function() { return 'fork' }
}
if (typeof actions[action] !== 'function') {
actions[action] = function() { return 'default' }
}
@ravindersahni
ravindersahni / curry.js
Created September 24, 2014 18:04
Succinct JavaScript Currying
function curry(fn, n) {
n = n || fn.length
return function(arg) {
if (--n <= 0) return fn(arg)
return curry(fn.bind(fn, arg), n)
}
}
@ravindersahni
ravindersahni / FizzBuzz.js
Last active August 29, 2015 14:06
Revealing Module FizzBuzz
var totallyEmployable = (function iffy() {
function fizzBuzz(options) {
var isFizz
, isBuzz
, i
options = options || {}
options.low = options.low || 1
options.high = options.high || 100
@ravindersahni
ravindersahni / app.js
Last active August 29, 2015 14:05
Comma-First Semicolon-Free Express 4 app.js Boilerplate
/* jshint bitwise : true, eqeqeq : true, forin : true, noarg : true, noempty : true, nonew : true,
asi : true, esnext : true, laxcomma : true, sub : true, browser : true, node : true, phantom : true */
const
express = require('express')
, path = require('path')
, favicon = require('static-favicon')
, logger = require('morgan')
, cookieParser = require('cookie-parser')
, bodyParser = require('body-parser')