Tested in Mac OS X: super == command
Open/Goto
- super+t: go to file
- super+ctrl+p: go to project
- super+r: go to methods
| #config/initializers/redis.rb | |
| require 'redis' | |
| require 'redis/objects' | |
| REDIS_CONFIG = YAML.load( File.open( Rails.root.join("config/redis.yml") ) ).symbolize_keys | |
| dflt = REDIS_CONFIG[:default].symbolize_keys | |
| cnfg = dflt.merge(REDIS_CONFIG[Rails.env.to_sym].symbolize_keys) if REDIS_CONFIG[Rails.env.to_sym] | |
| $redis = Redis.new(cnfg) | |
| Redis::Objects.redis = $redis |
| # RSpec's subject method, both implicitly and explicitly set, is useful for | |
| # declaratively setting up the context of the object under test. If you provide a | |
| # class for your describe block, subject will implicitly be set to a new instance | |
| # of this class (with no arguments passed to the constructor). If you want | |
| # something more complex done, such as setting arguments, you can use the | |
| # explicit subject setter, which takes a block. | |
| describe Person do | |
| context "born 19 years ago" do | |
| subject { Person.new(:birthdate => 19.years.ago } | |
| it { should be_eligible_to_vote } |
| task :environment do | |
| require './dj-sinatra' | |
| end | |
| namespace :jobs do | |
| desc "Clear the delayed_job queue." | |
| task :clear => :environment do | |
| Delayed::Job.delete_all | |
| end |
| # Our own variable where we deploy this app to | |
| deploy_to = "/srv/example.com" | |
| current_path = "#{deploy_to}/current" | |
| shared_path = "#{deploy_to}/shared" | |
| shared_bundler_gems_path = "#{shared_path}/bundler_gems" | |
| # See http://unicorn.bogomips.org/Sandbox.html | |
| # Helps ensure the correct unicorn_rails is used when upgrading with USR2 | |
| Unicorn::HttpServer::START_CTX[0] = "#{shared_bundler_gems_path}/bin/unicorn_rails" |
| # Dealing with namespaces in Nokogiri. | |
| # | |
| # First thing you must do is abandon what you're used to with Builder, | |
| # namespaces aren't just attributes on an element, they uniquely identify | |
| # what sort of element you are building and, as such, you are better off | |
| # specifying them manually. | |
| # | |
| # The key here is accessing the Nokogiri::XML::Element being built with | |
| # b.parent, then you can set the namespace (distinguished by an element | |
| # with a prefix such as "soap12:Envelope") or add a default namespace |