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
| require 'rubygems' | |
| if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
| begin | |
| $LOAD_PATH.concat Dir.glob('/home/vlad/.rvm/gems/ruby-1.9.3-p0@global/gems/*/lib') if RUBY_VERSION =~ /1.9.3/ # brutal hardcode | |
| require 'rvm' | |
| if defined?(::Bundler) | |
| #$LOAD_PATH.concat Dir.glob("#{ENV['rvm_ruby_global_gems_path']}/gems/*/lib") | |
| 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
| ######################################################## | |
| # | |
| # to get this work you should install 'expect' package: | |
| # | |
| # sudo apt-get install expect | |
| # | |
| ######################################################## | |
| desc "SSH Connect to servers" | |
| task :ssh do | |
| puts 'Aviable roles:' |
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
| [core] | |
| editor = gvim -f | |
| [color] | |
| branch = auto | |
| diff = auto | |
| status = auto | |
| [color "branch"] | |
| current = yellow reverse | |
| local = yellow | |
| remote = green |
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
| --type-set=sass=.sass | |
| --type-set=scss=.scss | |
| --type-set=haml=.haml | |
| --type-add=ruby=.haml | |
| --type-add=js=.javascript | |
| --ignore-dir=target/ | |
| --ignore-dir=.rsync_cache/ | |
| --ignore-dir=coverage/ |
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
| namespace :logs do | |
| desc '=> logs:rails' | |
| task :default do | |
| rails | |
| end | |
| desc "watch rails logs" | |
| task :rails, :roles => :app do | |
| stream "tail -f #{deploy_to}/shared/log/production.log" |
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
| # (1) copy the newrelic rpm java client into #{RAILS_ROOT}/solr/newrelic | |
| # (2) add a newrelic.yml in that directory with you API key | |
| # (3) add this monkey patch in an initializer to load newrelic with the solr server | |
| Sunspot::Server.class_eval do | |
| def run | |
| command = ['java'] | |
| command << "-Xms#{min_memory}" if min_memory | |
| command << "-Xmx#{max_memory}" if max_memory | |
| command << "-Djetty.port=#{port}" if port | |
| command << "-Dsolr.data.dir=#{solr_data_dir}" if solr_data_dir |
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
| class Location < ActiveRecord::Base | |
| searchable do | |
| integer :id | |
| spellchk :name | |
| latlon :lat | |
| latlon :lon | |
| string :geohash | |
| end | |
| class << self |
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
| class Comment < ActiveRecord::Base | |
| belongs_to :post | |
| def create_or_update | |
| super | |
| rescue ActiveRecord::InvalidForeignKey => e | |
| e.message =~ /REFERENCES `([^`]*)`/ | |
| errors[:"#{$1}"] = 'Foreign Key Constraint Failed' | |
| false | |
| 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
| Scenario: Get List of My Hitchhiking Items via API | |
| Given the existing things: | |
| |name| | |
| |The Guide (duh)| | |
| |A towel| | |
| |Sub-Etha Sens-O-Matic| | |
| |Pan Galactic Gargle Blaster| | |
| |Kill-o-Zap blaster pistol| | |
| And the existing accounts: | |
| |email|name|password| |
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
| class << Marshal | |
| def load_with_rails_classloader(*args) | |
| begin | |
| load_without_rails_classloader(*args) | |
| rescue ArgumentError, NameError => e | |
| if e.message =~ %r(undefined class/module) | |
| const = e.message.split(' ').last | |
| const.constantize | |
| retry | |
| else |