⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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
# Usage: | |
# profile_memory do | |
# # your_code_to_be_profiled_here... | |
# end | |
module ProfileUtils | |
def get_current_memory_usage | |
`ps -o rss= -p #{Process.pid}`.to_i | |
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
# Install from scratch | |
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) | |
# Update | |
rvm get head | |
# Install openssl | |
rvm pkg install openssl #(older format - rvm package install openssl) | |
# Install iconv | |
rvm pkg install iconv # (older format - rvm package install iconv) | |
# In case of problem, try to install without autoreconf |
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
ruby -I test test/functional/items_controller_test.rb -n 'mio_test' |
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
# see: http://stackoverflow.com/questions/4837427/mongo-ruby-connection-problem | |
sudo rm /var/lib/mongodb/mongod.lock | |
sudo -u mongodb mongod -f /etc/mongodb.conf --repair | |
sudo start mongodb | |
sudo status mongodb |
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
config.active_record.colorize_logging = false |
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
ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(STDOUT) |
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
brew install memcached libmemcached | |
env ARCHFLAGS="-arch x86_64" gem install memcached --no-ri --no-rdoc -- --with-libmemcached-dir=/opt/local |
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
# Got from here: http://www.skorks.com/2010/03/timing-ruby-code-it-is-easy-with-benchmark/ | |
require "benchmark" | |
Benchmark.bm(7) do |x| | |
x.report("first:") { (1..10000).each { |i| i } } | |
x.report("second:") { (1..10000).each { |i| i }} | |
x.report("third:") { (1..10000).each { |i| i }} | |
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
select array_to_string(array_agg(projects.name), ',')) as projects ... |
OlderNewer