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 ActiveShipping | |
class MyBuild < ActiveShipping::Fedex | |
def find_rates(*args) | |
results = super | |
# some code to customize the results | |
return results | |
end | |
end | |
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
module Workarea | |
module Search | |
class Brands | |
include ProductDisplayRules | |
def all_results | |
buckets = Array.wrap(response.dig('aggregations', 'all_brands', 'buckets')) | |
buckets.map { |b| b['key'] } | |
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
_key == '$in' ? new_val & old_val : old_val | new_val |
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
redis-cli keys 'query*' | awk '{ gsub("\"", "*", $1); print "\"" $1 "\"" }' | xargs redis-cli DEL |
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
1.9.3p194 :006 > Catalog::Product.last | |
=> #<Catalog::Product _id: PROD9990094, _type: nil, deleted_at: nil, version: 1, created_at: 2012-07-31 20:43:50 UTC, updated_at: 2012-07-31 20:43:50 UTC, slug: "test-product-211", display_starts_at: 2012-07-31 20:43:50 UTC, display_ends_at: nil, purchase_starts_at: 2012-07-31 20:43:50 UTC, purchase_ends_at: nil, site_id: 1, name: "Test Product 211", sale_starts_at: nil, sale_ends_at: nil, display_price_range: false, packaged_product_ids: []> | |
1.9.3p194 :007 > Catalog::Product.last.destroy | |
=> 0 | |
1.9.3p194 :008 > Catalog::Product.last | |
=> #<Catalog::Product _id: PROD9990094, _type: nil, deleted_at: 2012-08-02 16:46:50 UTC, version: 1, created_at: 2012-07-31 20:43:50 UTC, updated_at: 2012-07-31 20:43:50 UTC, slug: "test-product-211", display_starts_at: 2012-07-31 20:43:50 UTC, display_ends_at: nil, purchase_starts_at: 2012-07-31 20:43:50 UTC, purchase_ends_at: nil, site_id: 1, name: "Test Product 211", sale_starts_at: nil, sale_ends_at: nil, display_price_range: false, p |
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
{"ActionController::RoutingError"=>:not_found, | |
"AbstractController::ActionNotFound"=>:not_found, | |
"ActionController::MethodNotAllowed"=>:method_not_allowed, | |
"ActionController::NotImplemented"=>:not_implemented, | |
"ActionController::InvalidAuthenticityToken"=>:unprocessable_entity, | |
"ActiveRecord::RecordNotFound"=>:not_found, | |
"ActiveRecord::StaleObjectError"=>:conflict, | |
"ActiveRecord::RecordInvalid"=>:unprocessable_entity, | |
"ActiveRecord::RecordNotSaved"=>:unprocessable_entity | |
} |
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
data = { id: 'id', name: 'something' } | |
index = Tire::Index.new('index_name') | |
index.store(data) | |
index.refresh #(optionally) |
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
[user] | |
name = bcrouse | |
email = bcrouse@weblinc.com | |
[core] | |
[color] | |
ui = true | |
[merge] | |
tool = opendiff | |
[core] | |
editor = /usr/bin/vim |
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 AddItemToCartCommand | |
include Command | |
validate :sku, presence: true | |
validate :quantity, presence: true, numericality: { greater_than_or_equal_to: 1 } | |
def cart | |
Cart.from_session(params[:session_id]) | |
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
select 'Pennsylvania', from: 'shipping_address[region]' | |
NewerOlder