This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __git_dirty { | |
git diff --quiet HEAD &>/dev/null | |
[ $? == 1 ] && echo " ↺ " | |
} | |
function __git_branch { | |
__git_ps1 "%s" | |
} | |
function __my_rvm_ruby_version { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/deploy.rake | |
namespace :deploy do | |
desc 'Deploy to staging environment' | |
task :staging do | |
exec 'mina deploy -f config/deploy/staging.rb' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
autocrlf = input | |
safecrlf = true | |
[alias] | |
co = checkout | |
ci = commit | |
st = status | |
br = branch | |
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short | |
type = cat-file -t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Prelude hiding (catch) | |
import Network | |
import Network.Socket | |
import System.IO | |
import Control.Exception | |
import Control.Concurrent | |
main :: IO () | |
main = withSocketsDo $ do | |
addrInfos <- getAddrInfo Nothing (Just "localhost") (Just "1337") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar MathExpression; | |
INT : [0-9]+; | |
DOUBLE : [0-9]+'.'[0-9]+; | |
PI : 'pi'; | |
E : 'e'; | |
POW : '^'; | |
WS : [ \t\r\n]+ -> skip; | |
ID : [a-zA-Z_][a-zA-Z_0-9]*; | |
PLUS : '+'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gm convert original.jpg -thumbnail 200x200^ -gravity center -extent 200x200 +profile "*" thumbnail.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def memoize(f): | |
cache = {} | |
kwargs_mark = object() | |
@wraps(f) | |
def memoized(*args, **kwargs): | |
key = args + (kwargs_mark,) + tuple(sorted(kwargs.items())) | |
try: |