- Single Responsibity Principle (SRP).
- Skinny Controller, Fat Model.
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://stackoverflow.com/questions/8808909/simple-way-to-install-rabbitmq-in-ubuntu | |
echo "deb http://www.rabbitmq.com/debian/ testing main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list > /dev/null | |
sudo wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | |
sudo apt-key add rabbitmq-signing-key-public.asc | |
sudo apt-get update | |
sudo apt-get install rabbitmq-server -y | |
sudo service rabbitmq-server start | |
sudo rabbitmq-plugins enable rabbitmq_management | |
sudo service rabbitmq-server restart |
This guide is for a first-time Rails developer to deploy their app to Heroku, a popular web-hosting service with strong Rails support. This guide assumes you already have a Heroku account and have installed the Heroku Toolbelt.
- Make sure you've setup an SSH key for Heroku. Follow this simple guide to create an SSH key and send it to Heroku if needed: Heroku: Managing Your SSH Keys
- Navigate into the folder for your Rails app.
This is an example or boilerplate layout file. Your layout file is the frame rendered around every view in your app (via the <%= yield %>
erb tag at the bottom). Every Rails app has a layout file at app/views/layouts/application.html.erb
.
This layout file includes:
These steps are for Mavericks. Mileage will vary for older versions of Mac OS X but the broad strokes still apply. Google is your friend if you hit a snag. Comments welcome.
Install homebrew.
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
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 'active_support/core_ext/hash/keys' | |
class Hash | |
def recursively_symbolize_keys! | |
self.symbolize_keys! | |
self.values.each do |v| | |
if v.is_a? Hash | |
v.recursively_symbolize_keys! | |
elsif v.is_a? Array | |
v.recursively_symbolize_keys! |
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 'pry' | |
After( '@developing' ) do |scenario| | |
binding.pry if scenario.failed? | |
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
make () | |
{ | |
start=$(date +%s); | |
if command make "$@"; then | |
icon=checkbox; | |
else | |
icon=computer-fail; | |
fi; | |
nl=' | |
'; |
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
#config/initializers/redis.rb | |
require 'redis' | |
require 'redis/objects' | |
REDIS_CONFIG = YAML.load( File.open( Rails.root.join("config/redis.yml") ) ).symbolize_keys | |
dflt = REDIS_CONFIG[:default].symbolize_keys | |
cnfg = dflt.merge(REDIS_CONFIG[Rails.env.to_sym].symbolize_keys) if REDIS_CONFIG[Rails.env.to_sym] | |
$redis = Redis.new(cnfg) | |
Redis::Objects.redis = $redis |