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
alt + ñ | |
# https://superuser.com/questions/406356/how-to-make-a-tilde-on-a-spanish-keyboard-set-to-english/468186#468186?newreg=a472f6df8a554bf29714d3dcc03403ef |
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
# after including: | |
index({attribute: 1}, {unique: true}) | |
# run: | |
rake db:mongoid:create_indexes | |
# http://www.talkingquickly.co.uk/2013/06/indexes-with-mongoid-are-not-created-automatically/ |
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
users = User.all | |
progress_bar = ProgressBar.create({starting_at: 0, total: users.count, :format => '%e %B %P%% %t'}) | |
users.each do |user| | |
# ... | |
progress_bar.increment | |
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
.no_timeout after the query to run it without a timeout (Mongo) |
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
heroku ps:scale web=0 | |
heroku ps:scale web=1 | |
or | |
heroku maintenance:on | |
heroku maintenance:off | |
# http://stackoverflow.com/questions/2811453/how-to-stop-an-app-on-heroku |
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
cat production.log | grep duration | awk 'a=$7,gsub(/[a-z=]/,"",a) {print a, $1, $2}' | awk '{if ($1 > 500) print $1, $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
# config/environments/development.rb | |
config.cache_classes = false¬ | |
# In the development environment your application's code is reloaded on¬ | |
# every request. This slows down response time but is perfect for development | |
# since you don't have to restart the web server when you make code changes.¬ |
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
resources :name, only: [:show], path: :url_name |
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
Ctrl + o |
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
The default yank or delete goes into a place called a register (a register named "). If you need to delete some text before you paste, you need to avoid overwriting register x, as you've discovered. Fortunately, you can use any other letter or number to name a different register. | |
"ayy (yank a line into register a) | |
x, dd, etc. (delete some text into the unnamed register, ") | |
"ap (paste the text from register a) | |
# http://superuser.com/questions/371160/copy-delete-then-paste-in-vim |