The no-peeping-toms gem doesn't work properly with Rails 3.2.3.
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
| # List of environments and their heroku git remotes | |
| ENVIRONMENTS = { | |
| :staging => 'myapp-staging', | |
| :production => 'myapp-production' | |
| } | |
| namespace :deploy do | |
| ENVIRONMENTS.keys.each do |env| | |
| desc "Deploy to #{env}" | |
| task env do |
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
| # put this into /etc/logrotate.d/app-production | |
| # to have a Rails app running on unicorns rotating/rolling its logs monthly | |
| # check with logrotate -f /etc/logrotate.d/app-production | |
| /web/app/production/shared/log/*.log { | |
| monthly | |
| missingok | |
| rotate 24 | |
| compress | |
| delaycompress |
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
| du -x -k | sort -nr | head -<n> |
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
| # store all solarized files in one place | |
| mkdir ~/.solarized | |
| cd ~/.solarized | |
| # http://www.webupd8.org/2011/04/solarized-must-have-color-paletter-for.html | |
| git clone https://github.com/seebi/dircolors-solarized.git | |
| eval `dircolors ~/.solarized/dircolors-solarized/dircolors.256dark` | |
| ln -s ~/.solarized/dircolors-solarized/dircolors.256dark ~/.dir_colors | |
| git clone https://github.com/sigurdga/gnome-terminal-colors-solarized.git |
In researching topics for RailsCasts I often read code in Rails and other gems. This is a great exercise to do. Not only will you pick up some coding tips, but it can help you better understand what makes code readable.
A common practice to organize code in gems is to divide it into modules. When this is done extensively I find it becomes very difficult to read. Before I explain further, a quick detour on instance_eval.
You can find instance_eval used in many DSLs: from routes to state machines. Here's an example from Thinking Sphinx.
class Article < ActiveRecord::Base
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
| ~/ | |
| ↪ cd code/project | |
| project[master]/ | |
| ↪ cd - | |
| ~/ | |
| ↪ cd code/project | |
| project[master]/ |
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
| let g:rails_projections = { | |
| \ "config/projections.json": { | |
| \ "command": "projections" | |
| \ }, | |
| \ "spec/features/*_spec.rb": { | |
| \ "command": "feature", | |
| \ "template": "require 'spec_helper'\n\nfeature '%h' do\n\nend", | |
| \ }} | |
| let g:rails_gem_projections = { |
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
| #!/usr/bin/env ruby | |
| spec_hits = [] | |
| # Find the names of all the filenames in spec directory that have been (A)dded (C)opied or (M)odified | |
| filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n") | |
| filenames.each do |filename| | |
| if filename.end_with? '_spec.rb' | |
| results = `git diff --cached #{filename} | grep \^+\[\^+\] | grep focus` |
OlderNewer