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
### Models ### | |
class Post | |
include Mongoid::Document | |
references_many :properties, :stored_as => :array, :inverse_of => :posts, :index => true | |
end | |
class Property | |
include Mongoid::Document | |
field :name | |
references_many :posts, :stored_as => :array, :inverse_of => :properties |
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
# /test/integration/subdomain_test.rb | |
require 'integration_test_helper' | |
class SubdomainTest < ActionController::IntegrationTest | |
test "simple subdomain test" do | |
subdomain = "something" | |
# this test passes using selenium, fails using the default envjs | |
#Capybara.current_driver = :selenium | |
Capybara.app_host = "http://#{subdomain}.lvh.me:9887" |
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
### subdomain_test.rb | |
require 'integration_test_helper' | |
class SubdomainTest < ActionController::IntegrationTest | |
test "simple subdomain test" do | |
sub1 = "sub1" | |
sub2 = "sub2" | |
# this test passes using selenium | |
#Capybara.current_driver = :selenium |
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
require 'config/environment' | |
require 'mongo' | |
namespace :mongoid do | |
desc 'Update defaults' | |
task :defaults do | |
db = Mongoid.config.master | |
models.each do |m| | |
m = eval m |
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
module DeviseMailerWithAttributes | |
class Devise::Mailer < ::ActionMailer::Base | |
alias_method :old_confirmation_instructions, :confirmation_instructions | |
alias_method :old_reset_password_instructions, :reset_password_instructions | |
alias_method :old_unlock_instructions, :unlock_instructions | |
alias_method :old_invitation_instructions, :invitation_instructions | |
def confirmation_instructions(record, attributes={}) | |
set_attributes(attributes) |
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
# in /config/devise.rb | |
... | |
# Configure the class responsible to send e-mails. | |
#config.mailer = "Devise::Mailer" | |
config.mailer = "MailerWithInfo" | |
... | |
# in /lib | |
class MailerInfo | |
def self.attributes=(attributes={}) |
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 link_type_sprite(image, options = {}) | |
sprites = { | |
ReferrerClassifier::FACEBOOK => {:w => 20, :h => 20, :x => 5, :y => 0}, | |
ReferrerClassifier::TWITTER => {:w => 20, :h => 20, :x => 30, :y => 0}, | |
ReferrerClassifier::SEARCH => {:w => 20, :h => 20, :x => 55, :y => 0}, | |
ReferrerClassifier::BASIC => {:w => 20, :h => 20, :x => 80, :y => 0} | |
} | |
%(<div class="#{options[:class]}" style="background: url(#{path_to_image('/images/sn_icons/link-type-icon-sprite.png')}) no-repeat -#{sprites[image][:x]}px -#{sprites[image][:y]}px; width: #{sprites[image][:w]}px; height: #{sprites[image][:w]}px; #{options[:style]}" title="#{options[:title]}">#{options[:title]}</div>).html_safe | |
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
insert query update delete getmore command flushes mapped vsize res locked % idx miss % qr|qw ar|aw netIn netOut conn time | |
0 11 739 0 0 399 0 30.9g 64.4g 550m 43.9 0 0|0 0|1 183k 45k 10 16:03:25 | |
0 5 423 0 0 232 0 30.9g 64.4g 549m 65.1 0 0|0 0|1 106k 26k 10 16:03:26 | |
0 5 471 0 0 261 0 30.9g 64.4g 549m 58.9 0 0|0 0|0 119k 29k 10 16:03:27 | |
0 6 666 0 0 371 0 30.9g 64.4g 548m 50.4 0 0|0 0|0 166k 40k 10 16:03:28 | |
0 8 637 0 0 398 0 30.9g 64.4g 548m 43.8 0 0|0 0|0 167k 44k 10 16:03:29 | |
0 7 727 0 0 419 0 30.9g 64.4g 549m 32.1 0 0|0 0|1 185k 45k 10 16:03:30 | |
0 6 821 |
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
update bokchoy.unique_datas 261ms Tue Jul 10 2012 14:39:07 | |
query:{ | |
"n_id" : ObjectId("4e4afa8bac36dd000100006b"), | |
"dim" : "cat", | |
"dim_val" : "Best Of", | |
"cl_id" : ObjectId("4f6891ed0572c9000100017b"), | |
"t" : "u", | |
"v" : "7f4b9eb126a209da653852a6ec25baa9" | |
} updateobj:{ | |
"n_id" : ObjectId("4e4afa8bac36dd000100006b"), |
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
class MyMq | |
def self.client | |
unless @client | |
c = Bunny.new(APP_CONFIG["cloudamqp_url"], :logging => true) | |
c.start | |
@client = c | |
end | |
@client | |
end | |
OlderNewer