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
# Call scopes directly from your URL params: | |
# | |
# @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Call the class methods with names based on the keys in <tt>filtering_params</tt> | |
# with their associated values. For example, "{ status: 'delayed' }" would call |
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
# Original code from https://github.com/shakycode/ruby_sunday_refactor | |
# Second refactor, the addresses are objects! Create an address class that uses ValueType semantics | |
Address = Struct.new(:house_number, :street_address) do | |
def initialize(address) | |
super(*address.split(' ', 1).map(&:strip)) | |
end | |
end | |
# now to compare two addresses, create instance of the Address class and compare those objects with the == operator |
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('../boot', __FILE__) | |
require 'rails/all' | |
if ar_initdb = ActiveRecord::Railtie.initializers.find {|item| item.name == 'active_record.initialize_database'} | |
ActiveRecord::Railtie.initializers.delete(ar_initdb) | |
ActiveRecord::Railtie.initializer :after => ar_initdb.after do | |
ActiveSupport.on_load(:active_record) do | |
self.configurations = Rails.application.config.database_configuration |
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
--- /Users/phi/Temp/QxtGlobalShortcut_wrap.cxx 2013-03-04 10:01:25.000000000 +0100 | |
+++ /Users/phi/Temp/QxtGlobalShortcut_wrap_debug.cxx 2013-03-05 14:15:39.000000000 +0100 | |
@@ -1863,6 +1863,7 @@ | |
void *argp1 = 0 ; | |
int res1 = 0 ; | |
QxtGlobalShortcut *result = 0 ; | |
+ printf("_wrap_new_QxtGlobalShortcut__SWIG_0 ENTERING\n"); | |
if ((argc < 1) || (argc > 1)) { | |
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; |