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
class ModifyResponseHeaders | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
status, headers, body = @app.call(env) | |
headers["cache"] = "..." | |
[status, headers, body] | |
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
[alias] | |
st = status | |
s = status | |
co = checkout | |
c = commit -v | |
ci = commit -a -v | |
b = branch | |
d = diff | |
p = pull | |
a = add -A . |
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 parse_git_branch { | |
ref=`git symbolic-ref HEAD 2> /dev/null` || return | |
branch="${ref#refs/heads/}" | |
if [ $branch != "master" ] | |
then | |
echo "($branch)" | |
fi | |
} | |
function parse_rvm_prompt { |
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
# rackup app.ru | |
require "./invisible" | |
app = Invisible.new do | |
get "/" do | |
render do | |
h1 "Why?" | |
p "Because." | |
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
#!/usr/bin/env ruby | |
# Reveal in GitHub TextMate command | |
require 'pathname' | |
path = Pathname.new(ENV["TM_FILEPATH"]).relative_path_from(Pathname.new(ENV["TM_PROJECT_DIRECTORY"])) | |
repo_path = `/usr/local/bin/git remote show origin`[/Fetch URL: git@(.*)\.git$/, 1].tr(":", "/") | |
branch = `/usr/local/bin/git symbolic-ref HEAD`[/refs\/heads\/(.*)$/, 1] | |
exec "open 'http://#{repo_path}/blob/#{branch}/#{path}'" |
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
# In your .gitconfig | |
[alias] | |
ptp = !git pull && rake && git push | |
push-retry = !git push || git ptp |
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
// compile: gcc 0L.c | |
// example: | |
// ./a.out 00201320130 | |
// expanded: | |
// ./a.out \ | |
// 002 # LOAD R[0] = 2 \ | |
// 013 # LOAD R[1] = 3 \ | |
// 201 # ADD R[0] += R[1] \ | |
// 30 # PRINT R[0] | |
// should print: 5 |
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
require "talker" | |
module Connection | |
attr_accessor :client | |
def data_received(data) | |
client.send_message data | |
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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "mutter" | |
require "httparty" | |
REMOTE = "origin" | |
REPO = `git config --get remote.#{REMOTE}.url`.chomp[/github\.com[\/\:]([^\/]+\/[^\/]+)\.git/, 1] | |
USER = `git config --get github.user`.chomp | |
TOKEN = `git config --get github.token`.chomp |