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 hidden or 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 hidden or 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
http://ozmm.org/posts/erb_eval.html | |
Because I always forget how to do it: | |
require 'erb' | |
name = 'bob' | |
template = 'whatever, <%= name %>' | |
puts ERB.new(template).result(binding) | |
This file contains hidden or 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 hidden or 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
anil-wadghules-macbook:~ anildigital$ scp ~/.ssh/id_rsa.pub [email protected]:/home/anil | |
ssh: connect to host 67.207.133.219 port 22: Connection refused | |
lost connection |
This file contains hidden or 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
anil-wadghules-macbook:~ anildigital$ ssh -p 2222 [email protected] | |
ssh: connect to host 67.207.133.219 port 2222: Connection refused |
This file contains hidden or 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
[submodule "rinari"] | |
path = vendor/rinari | |
url = git://github.com/eschulte/rinari.git | |
[submodule "markdown-mode"] | |
path = vendor/markdown-mode | |
url = git://github.com/defunkt/markdown-mode.git | |
[submodule "twilight-emacs"] | |
path = vendor/twilight-emacs | |
url = git://github.com/crafterm/twilight-emacs.git | |
[submodule "vendor/fuzzy-find-in-project"] |
This file contains hidden or 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
Script started on Sun Dec 28 11:14:42 2008 | |
bash-3.2$ ex[K[Kgit submodule init | |
bash-3.2$ git sub[K[K[K[K[K[K[Kcat .gitmodules | |
[submodule "rinari"] | |
path = vendor/rinari | |
url = git://github.com/eschulte/rinari.git | |
[submodule "markdown-mode"] | |
path = vendor/markdown-mode | |
url = git://github.com/defunkt/markdown-mode.git | |
[submodule "twilight-emacs"] |
This file contains hidden or 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 'sinatra' | |
require 'cheat' | |
get "/" do | |
@cheats = "" | |
@cheats = (`cheat sheets`).split("\n") | |
puts @cheats.inspect | |
erb :index, :locals => { :cheats => @cheats} | |
end |
This file contains hidden or 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
<% cheats = (`cheat sheets`).split("\n") %> | |
<% cheat = (`cheat #{cheats[rand(cheats.size)]}`).split("\n") %> | |
<body> | |
<div id="cheat_block"> | |
<div id="cheat_name"> | |
<%= cheat[0] %> | |
</div> | |
<% cheat.shift %> | |
<div id="cheat_info"> |