Skip to content

Instantly share code, notes, and snippets.

@homelinen
homelinen / lambda-snippet.tex
Created November 4, 2012 16:17
Lambda Calculus in LaTeX
\begin{eqnarray*}
&& (\lambda xyz.xyz)(\lambda x.xx)(\lambda x.x)x \\
& \to_\beta & (\lambda yz.xyz)[x := \lambda x.xx](\lambda x.x)x \\
& \equiv & (\lambda yz.(\lambda x.xx)yz)(\lambda x.x)x \\
& \to_\beta & (\lambda yz.(xx)[ x := y]z)(\lambda x.x)x \\
& \equiv & (\lambda yz.yyz)(\lambda x.x)x \\
& \to_\beta & (\lambda z.yy)[ y := \lambda x.x ]x \\
& \equiv & (\lambda z.(\lambda x.x)(\lambda x.x)z)x \\
& \to_\beta & (\lambda z.x[x := \lambda x.x]z)x \\
& \equiv & (\lambda z.(\lambda x.x)z)x \\
@leh
leh / restart_tmux
Created October 18, 2012 15:58
start or restore a tmux session named after your current working directory
# Switching projects like mad?
# t: start or restore a tmux session named after your current working directory
#
# e.g. calling t in /home/project/awesome_project will reattach the tmux session named
# awesome_project or create a new one
t() { tmux attach-session -t $(pwd | awk -F/ '{print $NF}') || tmux new-session -s $(pwd | awk -F/ '{print $NF}') ; }
#!/usr/bin/env ruby
def get_values(string, expression)
regex = Regexp.new(expression.gsub(/\{([^\}]+)\}/) { "(?<#{$1}>\\S+)" })
(match = regex.match(string)) ? Hash[match.names.zip(match.captures)] : {}
end
p get_values "Alice is 23 years old", "{name} is {age} years old" #=> {"name"=>"Alice", "age"=>"23"}
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ngauthier
ngauthier / README.md
Created July 5, 2012 20:10
Rdio "native" in linux

I like Rdio and linux. Rdio works great in a browser except for one thing: keyboard shortcuts!!!

When coding, I like to be able to play/pause my music quickly, meaning I don't want to switch windows. I figured out a way to do this:

Google Chrome --app

First, I made a file in my ~/bin called rdio that runs:

google-chrome --app=http://rdio.com
var ALPHA = 'abcdefghijklmnopqrstuvwxyz',
ALPHA_UPPER = ALPHA.toUpperCase(),
NUMERIC = '0123456789',
PUNCTUATION = '-!@£$%^&*()[]{}\'"/?.>,<;:\\|~`€#',
UNDERSCORE = '_',
WHITESPACE = '\x20\t\n\r\f\v\xa0\u2028\u2029\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff'; // thanks Mathias!
var SHORTHAND_CC = {
'\\S': ALPHA + ALPHA_UPPER + NUMERIC + PUNCTUATION + UNDERSCORE,
'\\s': WHITESPACE,
@minitech
minitech / new-convert-to-array.js
Created May 19, 2012 22:52
Why you should use my new way to convert to an array
// The data
var items = document.getElementsByTagName('p');
// The old way
var arr = Array.prototype.slice.call(items);
// Pros:
// - Doesn't need a helper method that loops through stuff
//
// Cons:
@paulmillr
paulmillr / active.md
Last active May 15, 2024 02:25
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 1000)
@liamdon
liamdon / gist:2467603
Created April 22, 2012 23:53
CoffeeScript, Jade and Stylus syntax highlighting in Sublime Text 2

Step 1: Clone the bundles into your Sublime Text packages directory

cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScript
git clone https://github.com/miksago/jade-tmbundle.git Jade
git clone https://github.com/LearnBoost/stylus.git Stylus

Step 2: Restart Sublime Text 2

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"