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 ApplicationController < ... | |
#... | |
protected | |
# session[:current_vendor_id] | |
def current_vendor | |
@current_vendor ||= vendor_from_session unless @current_vendor == false |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Scaling Rails</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<style type="text/css"> | |
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); | |
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); | |
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); |
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 variant_includes | |
[:default_price, :product, collections: [:images, :collection_series], :images, :product => [:master => :images]] | |
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
Spree::Variant.class_eval do | |
scope :with_distinct_images, -> { | |
variant_assets_sql = "SELECT MD5(GROUP_CONCAT(`spree_assets`.`image_type`, `spree_assets`.`attachment_file_name`)) FROM `spree_assets` | |
WHERE `spree_assets`.`type` IN ('Spree::Image') AND `spree_assets`.`viewable_id` = `spree_variants`.`id` AND `spree_assets`.`viewable_type` = 'Spree::Variant' | |
ORDER BY `spree_assets`.`image_type` ASC, `spree_assets`.`attachment_file_name` ASC" | |
variant_product_assets_sql = "SELECT MD5(GROUP_CONCAT(`spree_assets`.`image_type`, `spree_assets`.`attachment_file_name`)) FROM `spree_assets` | |
INNER JOIN `spree_products` ON `spree_products`.`deleted_at` IS NULL | |
INNER JOIN `spree_variants` `variants_including_masters_spree_products_join` ON `variants_including_masters_spree_products_join`.`product_id` = `spree_products`.`id` AND `variants_including_masters_spree_products_join`.`is_master` = 1 AND `variants_including_masters_spree_products_join`.`deleted_at` IS NULL | |
WHERE `spree_products |
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
ambiguity effect | |
anchoring | |
availablitlty heuristics | |
backfire effect | |
bandwagon effect | |
barnum effect | |
Base rate neglect or base rate fallacy | |
belief bias | |
bias blind spot | |
choice-supportive bias |
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
# ==with | |
# | |
# We have been struggling with the absence of @with@ blocks | |
# in Ruby for a long time. We had something similar in | |
# Object Pascal. | |
# | |
# Let me explain what it does: | |
# | |
# with Invoice.find_by_id(params[:id]) do |invoice| | |
# puts invoice.total |
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
# From https://github.com/lukeludwig/rack_timer | |
# mentioned at http://pulse.sportngin.com/news_article/show/137153 | |
# | |
# Environment configuration, e.g. heroku.yml: | |
# | |
# RACK_TIMER = true | false # instrument middleware? | |
# RACK_TIMER_LOG = true | false # enable logging for each middleware | |
# RACK_TIMER_LOG_THRESHOLD = 100 # threshold in ms when logs are written | |
# RACK_TIMER_NEWRELIC_INSTRUMENTATION = true | false # enable Newrelic instrumentation | |
# |
NewerOlder