Skip to content

Instantly share code, notes, and snippets.

find $(manpath | tr ':' '\n') -iname '*.1' | xargs cat | (LC_CTYPE=C tr -C '[:alnum:]-_' '\n') | egrep '^--[\-_[:alnum:]]+$' | sort | uniq -c | sort -n
@Tangent128
Tangent128 / example.js
Last active August 29, 2015 14:09
Async jQuery loader + script dependency resolver. Including this will asynchronously load jQuery, and allow other scripts to register functions to be called once jQuery is available. Importantly, you can safely use the "async" attribute when referencing this script. Dependency resolution is handled by passing the loaded functions an on-demand ge…
// each file needs to start with this to make sure the async array/object exists:
var async = async || [];
// these blocks could be in any order or different files:
async.push(function($, loaded) {
// loaded(name) returns a $.Deferred object, which modules can wait on or resolve as appropriate.
loaded("C").then(function(C) {
console.log("loaded A, needed "+C);
loaded("A").resolve("apple");
});
@fathat
fathat / triangle.py
Created May 27, 2011 23:12
Infinitely prints fractal triangles using only one root expression and no statements.
(lambda:
not globals().__setitem__('sys', __import__('sys'))
and not globals().__setitem__('this', sys.modules[globals()['__name__']])
and not globals().__setitem__('time', __import__('time'))
and
#program
[setattr(this, k, v) for k,v in {
'set_color': (lambda c: w(['*', ' '][c])),
'abs': (lambda t: (t + (t >> 31)) ^ (t >> 31)),
'w': sys.stdout.write,
@jamesgecko
jamesgecko / install.sh
Created June 16, 2012 20:38
Setup Ruby with rbenv on Ubuntu 12.04
# Dependencies (swiped from RVM)
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
# rbenv
cd
git clone git@github.com:sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
# ruby-build
mkdir -p ~/.rbenv/plugins
@phred
phred / config.fish
Created October 23, 2012 18:06
phred's config.fish
if status --is-login
# Use universal variables to replace globals, this lets set -Ux change PATH and LANG forever
set -ge PATH
set -gx PATH $PATH
set -ge LANG
set -gx LANG $LANG
function e
emacsclient -n $argv
[1] pry(main)> module MyModule
| def stuff
| include Module.new {
| def my_method
| puts "bar!"
| end
| }
| end
| end
=> nil
@tonyg
tonyg / mtl2.rkt
Last active December 18, 2015 22:59
From zero to cooperative threads in 15 lines of Racket code (after <http://www.haskellforall.com/2013/06/from-zero-to-cooperative-threads-in-33.html>)
#lang racket/base
(require data/queue)
(provide fork yield done run-threads)
(define current-runqueue (make-parameter #f))
(define (fork thunk)
(enqueue! (current-runqueue) (lambda () (thunk) (done))))
(define (yield)
@xaviershay
xaviershay / build_frontend.sh
Last active December 24, 2015 20:49
SASS + Coffee + Concatenation in prod
#!/bin/bash
set -exo pipefail
BUILD_ENV=$1
if [ `uname` == 'Darwin' ]; then
OSX=1
JSCOMPRESSOR="yuicompressor --type js"
else
OSX=
@pera
pera / gist:2624765
Created May 6, 2012 22:02
Improve move speed on Vim
" Improve move speed
let g:boostmove=0
set updatetime=500
au CursorMoved * call BoostMoveON()
au CursorMovedI * call BoostMoveON()
au CursorHold * call BoostMoveOFF()
au CursorHoldI * call BoostMoveOFF()
function BoostMoveON()
if (winline() != line('$')) && (line('.') != 1)
if (winline() == winheight('.')) || (winline() == 1)
@rubiii
rubiii / how_it_works.md
Created December 2, 2012 11:14
MacVim-Formatter for RSpec
$ rspec --format MacVimFormatter --color spec