- Your class can be no longer than a hundred lines of code.
- Your methods can be no longer than five lines of code
- You can pass no more than four parameters and you can't just make it one big hash.
- In your controller, you can only instantiate one object, to do whatever it is that needs to be done.
- Your view can only know about one instance variable.
- Your Rails view should only send messages to that object i.e., no Demeter violations.[ "thunder dome principal". Translated: one model in, one model out! ]
- Rules are meant to be broken if by breaking them you produce better code. [ ...where "better code" is validated by explaining why you want to break the rule to someone else. ]
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( $ ){ | |
var settings = { | |
lat: 38.651198, | |
lng: -97.976074, | |
address: '', | |
minimumDetailZoom: 4, | |
defaultZoom: 4, | |
displayLitBuildings: false, | |
displayCentralOffices: false, | |
dslHeatmapActive: false, |
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
$(document).ready -> | |
$('form').submit -> | |
$(this).find('.ajax-loader').show() |
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
#!/bin/bash | |
main() { | |
if [ -z $1 ]; then | |
echo "Usage: expand-url URL" | |
exit 1 | |
fi | |
url=$1 | |
response $url | parse_redirect | |
} |
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
$ ruby rollout.rb | |
$ stalk jobs.rb |
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
# Ruby 1.8.7 | |
source "https://rubygems.org" | |
gem "json_pure" | |
group :test do | |
gem "rspec" | |
gem "vcr" | |
gem "webmock" |
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 FiatNil | |
def method_missing(*args) | |
nil | |
end | |
end |
- cane: https://github.com/square/cane
- Capybara: https://github.com/jnicklas/capybara
- REST Client: https://github.com/archiloque/rest-client
- Savon: https://github.com/savonrb/savon
- Unicorn: https://github.com/defunkt/unicorn
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
# drop this task in the environment(s) you want to confirm deployment for | |
before :deploy, "deploy:confirm" | |
namespace :deploy do | |
desc "Should we really deploy?" | |
task :confirm do | |
if Capistrano::CLI.ui.ask("Are you sure?") == "yes" | |
puts "You got it buddy. Imma deploy now." | |
else |