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
# change name for generated routes | |
map.resources :posts, :as => 'articles' | |
# manually update any custom routes that use the old name | |
map.post_draft '/article/:id/:token', :controller => 'posts', :action => 'show', :conditions => { :method => :get } |
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
# model: | |
def to_param | |
login.parameterize | |
end | |
# for controllers (the User controller and all the controllers that are | |
# nested under it, or in other namespaces): replace User.find(params[:id]) with | |
User.find_by_login(params[:id]) |
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
def current_object | |
User.find_by_login(params[:id]) | |
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
# if you used the more general | |
get :edit, :id => @user.to_param | |
# instead of the specific | |
# get :edit, :id => @user.id |
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
# ack | |
alias ack="ack-grep -i -a" | |
jack() { | |
ack $1 --ignore-dir=vendor --ignore-dir=cache --ignore-dir=stubs public/javascripts | |
} | |
sack() { | |
ack $1 public/stylesheets/sass | |
} |
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 - translation/localization for time_ago_in_words - Romanian | |
ro-RO: | |
datetime: | |
distance_in_words: | |
less_than_x_minutes: | |
one: 'mai putin de un minut' | |
other: 'mai putin de {{count}} minute' | |
x_minutes: | |
one: 'un minut' | |
other: '{{count}} minute' |
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
iDon't know vim :(.<ESC>^2WBc2wbetter now<ESC><RIGHT>Da.<ESC>II can understan<ESC><RIGHT>~dE |
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
i => insert before cursor: | |
Don't know vim :(. => type Don't know vim :(. | |
<ESC> => go to normal mode | |
^ => move to the begining of the line (not blank character) | |
2W => move to the begining of the next space-separated word, 2 times | |
B => move backwards one space-separated-word | |
c2w => change to the begining of the next word, 2 times | |
better now => type better now | |
<ESC> => go to normal mode | |
<RIGHT> => move one character to the right |
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
# bash: kill the process that occupies <port> | |
kill $(lsof -t -i :4567) |
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
# kill [firefox, profile] | |
ps aux | grep [f]irefox | grep ***profilename*** | awk '{print $2 }' | xargs kill -9 |
OlderNewer