Skip to content

Instantly share code, notes, and snippets.

atmin / gist:9118764
Created Feb 20, 2014
Git precommit hook: lint Python files, check for debugger statements
View gist:9118764
py_files=`git diff --name-only HEAD|grep '.py$'`
grep -n 'pdb.set_trace()' $py_files && echo -e "\033[1;31m Debugger statements!!!\033[0m" && exit 1
pyflakes $py_files && exit || echo -e "\033[1;31m Lint error!\033[0m"
exit 1
atmin / app.js
Last active Aug 29, 2015 rewrite using jtmpl
View app.js
// This is a remake concept of using [jtmpl]( as only dependency
(function () {
var model = {
// Route: share
'#share': function () {
this.route = '#share-template'
atmin / vcenter.css
Created Mar 6, 2014
CSS vertical center, IE9+
View vcenter.css
/* src: */
.vcenter {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
View SimpleTrie.js
function Trie(key) {
View gist:f688a318db6bf8b68384
### Keybase proof
I hereby claim:
* I am atmin on github.
* I am atmin ( on keybase.
* I have a public key whose fingerprint is 06A7 F329 1A15 C68B 310E D752 EF90 6F97 1199 9FC9
To claim this, I am signing this object:
from fabric.api import local
import sys, os, webbrowser, jinja2
BASE_PATH = sys.path[0]
SRC_PATH = os.path.join(BASE_PATH, 'src')
BUILD_PATH = os.path.join(BASE_PATH, 'build')
JINJA_ENV = jinja2.Environment(loader=jinja2.FileSystemLoader(SRC_PATH))
atmin / rateLimit.js
Last active Dec 20, 2015
Execute given `func`tion no more often than once every `delay` milliseconds, queue all calls, do not drop anything (unlike throttle and debounce)
View rateLimit.js
** Execute given `func`tion no more often than once every `delay` milliseconds,
** queue all calls, do not drop anything (unlike throttle and debounce)
** Example usage:
** rateLimitedFunc = rateLimit(function (i) { console.log(i) }, 500)
** for (var i=0; i < 10; i++) rateLimitedFunc(i)
function rateLimit(func, delay) {
var queue = [],
atmin /
Created Oct 18, 2013
JavaScript RegExp monad
# Need this in JavaScript? Use "Try CoffeeScript"
# A micro DSL for building maintainable, complex, dynamic regular expressions
reBuild = ->
re = ''
self = {
# Append regular expression
atmin /
Last active Dec 29, 2015 — forked from mhl/
Compare git revisions via meld in a more sane way than `git difftool` Usage: rev1 rev2 e.g. HEAD HEAD~3
# This fork works under Python 2.x
# This is script that extracts the trees of two commits to temporary
# directories and then runs meld on both directories, so you can compare
# them using meld's nice recursive browsing interface.
# This is for an answer to this question:
atmin / tmux-debian-wheezy
Created Jun 16, 2016
Install tmux > 1.8 on Debian Wheezy
View tmux-debian-wheezy
# tmux 1.8 offers Zoom mode
sudo add-apt-repository ppa:pi-rho/dev
sudo apt-get update
sudo apt-cache show tmux # list tmux versions
sudo apt-get install tmux=LAST_VERSION_LISTED