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
MVIM Cheat Sheet: | |
* auto complete | |
ctrl+n | |
or | |
ctrl+p | |
* Running Rake for test | |
:Rake |
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
# Rails 3 generator for miniskirt | |
# Add the factory_girl gem | |
append_file 'Gemfile', <<-GEMS | |
group :test do | |
gem 'miniskirt' | |
end | |
GEMS | |
# touch the file for storing factories |
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
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config |
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 ImageMagick | |
def self.palette(image_file, number_of_colours = 5) | |
image_details = %x(convert #{image_file} +dither -depth 8 -colors #{number_of_colours} -unique-colors txt:-) | |
image_details.scan(/#[a-z0-9]{6}/i) | |
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
# Factory girl, relaxed. | |
# | |
# Factory.define :user do |f| | |
# f.login 'johndoe%d' # Sequence. | |
# f.email '%{login}@example.com' # Interpolate. | |
# f.password f.password_confirmation('foobar') # Chain. | |
# end | |
# | |
# Factory.define :post do |f| | |
# f.user { Factory :user } # Blocks, if you must. |
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
### Basic routes ### | |
Rails 2: | |
# singular resource | |
map.resource :account | |
# resources with addition member & collection actions | |
map.resources :games, :member => { :download => :get }, :collection => { :favourites => :get } | |
Rails 3: |
NewerOlder