Skip to content

Instantly share code, notes, and snippets.

@wassname
wassname / permutations.js
Last active June 28, 2022 22:53
Combinatorics permutatons and product in javascript using lodash.js (like python's itertools)
/**
* Lodash mixins for combinatorics
* by: wassname & visangela
* url: https://gist.github.com/wassname/a882ac3981c8e18d2556/edit
* lodash contrib issue: https://github.com/node4good/lodash-contrib/issues/47
* lic: same as lodash
* Inspired by python itertools: https://docs.python.org/2.7/library/itertools.html
*
* Usage:
* permutations([0,1,2],2) // [[0,1],[0,2],[1,0],[1,2],[2,0],[2,1]]
@rakeshtembhurne
rakeshtembhurne / bootstrap-popover-placement-extra-v2.0.3.css
Created September 27, 2012 12:38
CSS: Twitter Bootstrap Popover extra placements for v2.0.3
.popover.top-left, .popover.top-right {
margin-top: -5px;
}
.popover.bottom-left, .popover.bottom-right {
margin-top: 5px;
}
.popover.top-left .arrow {
bottom: 0;
left: 20%;
@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@jrbasso
jrbasso / pre-commit
Created March 31, 2012 21:54
Pre commit hook for CakePHP
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
echo "Checking PHP Lint..."
FILES=""
for FILE in `git diff --cached --name-only --diff-filter=ACMR HEAD | egrep \\\\.\(php\|ctp\)\$`
do
php -l -d display_errors=0 $PROJECT/$FILE
if [ $? != 0 ]