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
| #trace mongo in RPM | |
| Mongo::Collection.class_eval do | |
| include NewRelic::Agent::MethodTracer | |
| add_method_tracer :find | |
| add_method_tracer :find_one | |
| add_method_tracer :find_and_modify | |
| add_method_tracer :update | |
| add_method_tracer :insert | |
| add_method_tracer :save | |
| add_method_tracer :remove |
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
| module CanCan | |
| class Query | |
| def sanitize_sql(conditions) | |
| conditions | |
| end | |
| end | |
| # customize to handle Mongoid queries in ability definitions conditions | |
| class CanDefinition | |
| def matches_conditions_hash?(subject, conditions = @conditions) |
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
| // this allows culerity to wait until all ajax requests have finished | |
| jQuery(function($) { | |
| var original_ajax = $.ajax; | |
| var count_down = function(callback) { | |
| return function() { | |
| try { | |
| if(callback) { | |
| callback.apply(this, arguments); | |
| }; | |
| } catch(e) { |
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 File.expand_path(File.dirname(__FILE__) + '/spec_helper') | |
| describe 'Machinist' do | |
| models = Dir[File.expand_path(File.dirname(__FILE__) + '/../app/models/*.rb')]. | |
| map{|file| File.basename(file, '.rb') } - %w{mailer} | |
| models.map{ |model| model.classify.constantize }.each do |model| | |
| it "should have a blueprint for the #{model} model" do | |
| model.make.should be_instance_of(model) | |
| 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
| require 'masquerade' | |
| run Sinatra::Application |
NewerOlder