Tests build confidence. Write 'em. They'll save your ass, and they'll let you take a chainsaw to your code without being afraid of unintended consequences.
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
# my new favorite bashrc function | |
# quickly inspect source files in style | |
function pless { | |
pygmentize $1 | less -r | |
} | |
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 Array | |
def second | |
self[1] | |
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
require 'rubygems' | |
require 'ruby-prof' | |
RubyProf.measure_mode = RubyProf::PROCESS_TIME | |
RubyProf.start | |
require 'config/environment' | |
results = RubyProf.stop | |
File.open "loading-graph.html", 'w' do |file| | |
RubyProf::GraphHtmlPrinter.new(results).print(file) |
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
set foldmethod=syntax | |
set foldlevelstart=1 | |
set foldnestmax=5 | |
let javaScript_fold=1 | |
set textwidth=0 | |
"set foldclose=all | |
"colorscheme torte | |
" os x backspace fix |
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 "benchmark" | |
Benchmark.bm do |x| | |
5.times do | |
x.report do | |
o = Object.new | |
10000.times do | |
def o.method; end | |
end | |
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
# Allow the metal piece to run in isolation | |
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails) | |
class Scaling | |
def self.call(env) | |
if env["PATH_INFO"] =~ /^\/scaling/ | |
[200, {"Content-Type" => "text/html"}, ["Hello, World!"]] | |
else | |
[404, {"Content-Type" => "text/html"}, ["Not Found"]] | |
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
# SUPER DARING APP TEMPLATE 1.0 | |
# By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |
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
## | |
# command aliases | |
## | |
alias die="killall" | |
alias ls="ls -G" # default settings for list (colors) | |
alias l="ls -GFh" | |
alias ll="ls -lFGh" | |
alias la="ls -laFGh" | |
alias dir="ls -asGh" # setup dir command just in case ;) |
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
module Rack | |
class Evil | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
catch(:response) { @app.call(env) } | |
end | |
end |
OlderNewer