Skip to content

Instantly share code, notes, and snippets.

View lalitkapoor's full-sized avatar

Lalit Kapoor lalitkapoor

View GitHub Profile
//Storify -- Khuram Malik
// Required Modules
var app = require('express').createServer()
, io = require('socket.io').listen(app)
, express = require('express')
, mongoose = require ('mongoose')
, Schema = mongoose.Schema;
@lalitkapoor
lalitkapoor / hack.sh
Created March 31, 2012 16:55 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@lalitkapoor
lalitkapoor / latency.txt
Created June 1, 2012 17:02 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
SSD random read 150,000 ns
Read 1 MB sequentially from memory 250,000 ns 0.25 ms
Round trip within same datacenter 500,000 ns 0.5 ms
@lalitkapoor
lalitkapoor / wordpress-search-jquery.js
Created June 12, 2012 20:33 — forked from Ollo/wordpress-search-jquery
wordpress jquery search field behavior
// search box behavior text behavior
$('.searchField').focus(function(){
$('#searchsubmit,.searchWrapper').addClass('active');
$('.searchField').val('');
});
$('.searchField').blur(function(){
$('#searchsubmit,.searchWrapper').removeClass('active');
if($('.searchField').val() == '')
$('.searchField').val('Search...');
});
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
cat: meow
dog: bark
@lalitkapoor
lalitkapoor / getPublicSuffix.js
Created January 31, 2014 21:49
getPublicSuffix
function getPublicSuffix(domain) {
/*
* Copyright GoInstant, Inc. and other contributors. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@lalitkapoor
lalitkapoor / gist:9225721
Created February 26, 2014 08:23
git log graph
* 8995d17 - Merge branch 'f'
|\
| * 4c849d8 - (f) Merge branch 'd' into f
| |\
| | * cd74de4 - (d) d3
| | * ecf6caf - d2
| | * b48beec - d1
* | | dce8c66 - h1
* | | dbd467a - g1
|/ /
@lalitkapoor
lalitkapoor / angular-xeditable.js
Created February 29, 2016 05:52
angular-xeditable without using form tags
/*!
angular-xeditable - 0.1.9
Edit-in-place for angular.js
Build date: 2015-03-26
*/
/**
* Angular-xeditable module
*
*/
angular.module('xeditable', [])