View 20180426120831_dev_shard_1_extraction.rb
require Rails.root.join 'support/2018/20180202160337_db_extraction'
class DevShard1Extraction < ActiveRecord::Migration[5.1]
extractor = DbExtraction.new
if extractor.db_match?
raise 'Please set the shard 1 DB to be different from primary DB. You may take the config/deploy/templates/database.yml or modify your own copy.'
end
shard 1
def change
return unless Rails.env.development?
View test.log
[2018-04-20 12:37:47.513] x27[1mx27[35m (11.0ms)x27[0m x27[1mx27[35mSET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci, @@SESSION.sql_mode = 'TRADITIONAL', @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483x27[0m
[2018-04-20 12:37:47.524] x27[1mx27[35m (0.2ms)x27[0m x27[1mx27[35mBEGIN /* shard nil master */x27[0m
[2018-04-20 12:37:47.524] x27[1mx27[35m (0.1ms)x27[0m x27[1mx27[35mBEGIN /* shard 1 master */x27[0m
[2018-04-20 12:37:48.336] x27[1mx27[35m (0.2ms)x27[0m x27[1mx27[35mSAVEPOINT active_record_1 /* shard nil master */x27[0m
[2018-04-20 12:37:48.362] x27[1mx27[36mAccount Exists (6.0ms)x27[0m x27[1mx27[34mSELECT 1 AS one FROM `accounts` WHERE `accounts`.`api_key` = BINARY 'XFgLPXsZRCUKD3lx68a' LIMIT 1 /* shard nil master */x27[0m
[2018-04-20 12:37:48.364] x27[1mx27[36mAccount Exists (0.3ms)x27[0m x27[1mx27[34mSELECT 1 AS one FROM `accounts` WHERE `accounts`.`name` = 'Account 1' LIMIT 1 /* shard nil master */x27[0m
[2018-04-20 12:37:48.392] x27[1mx27[35mSQL (0.5ms)x27[0m x
View spellgood
#!/usr/bin/env ruby
new_words = ARGV
file_name = File.dirname(__FILE__) + "/../.pronto_spell.pws"
lines = File.read(file_name)
words = lines.split("\n")
header = words.shift
new_words.each do |word|
unless words.include?(word)
words << word
end
View gist:5ef38bfa60bcd47b3495b8acb0967a5d
app/grids/people_grid.rb|102| scope.with_property_value(key.id, value, :cp_1)
app/grids/people_grid.rb|110| scope.with_property_value(key.id, value, :cp_2)
app/models/activity.rb|136| joins(offer: :person).merge(Person.with_property_value(key_id, value))
app/models/concerns/customizable_properties.rb|7| scope :with_property_value, ->(key_id, value, table_alias = :custom_properties) {
app/models/customer_email.rb|141| joins(offer: :person).merge(Person.with_property_value(key_id, value))
app/models/incentive_outcome.rb|99| joins(offer: :person).merge(Person.with_property_value(key_id, value))
app/models/offer.rb|120| joins(:person).merge(Person.with_property_value(key_id, value))
app/models/offer_share.rb|82| joins(:person).merge(Person.with_property_value(key_id, value))
app/models/referral.rb|248| joins(offer: :person).merge(Person.with_property_value(key_id, value))
app/models/visitor_offer.rb|133| joins(offer: :person).merge(Person.with_property_value(key_id, value))
View md.md

Fits

WHERE (`custom_properties`.`person_id` = 197950367 OR `custom_properties`.`visitor_id` = 1052274563) AND ...

WHERE (`campaigns`.`activates_at` BETWEEN '2018-02-22 14:30:07' AND '2018-02-22 14:30:54' OR `campaigns`.`expires_at` BETWEEN '2018-02-22 14:30:07' AND '2018-02-22 14:30:54') AND ...

WHERE (role='admin' OR staff_member=1) AND

WHERE (`incentive_outcomes`.`target_type` = "Referral" OR `referrals`.`status` IN ('approved','unblocked')) AND ...
View zz.diff
where(person_id: Person.find_by(email: email, site_id: site_id), site_id: site_id)
}
+ scope :by_coupon_list, ->(coupon_list_id) {
+ sub_query = Coupon.
+ joins('INNER JOIN `checkout_coupons` ON `checkout_coupons`.`coupon_id` = `coupons`.`id`').
+ where('`origins`.`id` = `checkout_coupons`.`purchase_id`').where(coupon_list_id: coupon_list_id)
+ where("exists (#{sub_query.to_sql})")
+ }
+
View gist:6b963df28ccec53f0031199283dd38e0
[4c015ea6bb27] Started POST "/internal/localization_override" for 127.0.0.1 at 2017-11-22 15:03:21 +0200
[4c015ea6bb27] [ETagCahing] ETag: none
[2017-11-22 15:03:21.601] Processing by Internal::LocalizationOverrideController#create as JSON
[4c015ea6bb27] [master/1] User Load (0.5ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 5139 LIMIT 1
[4c015ea6bb27] [master/1] (0.3ms) BEGIN
[4c015ea6bb27] [master/1] SQL (0.5ms) UPDATE `users` SET `perishable_token` = 'wLM6kWLPS4Nb3b5eGhA', `last_request_at` = '2017-11-22 13:03:21', `updated_at` = '2017-11-22 13:03:21' WHERE `users`.`id` = 5139
[4c015ea6bb27] [master/1] CustomAttribute Load (0.5ms) SELECT `custom_attributes`.* FROM `custom_attributes` WHERE `custom_attributes`.`foreign_id` = 5139 AND `custom_attributes`.`model` = 'User'
[4c015ea6bb27] [master/1] (0.3ms) COMMIT
[4c015ea6bb27] [master/1] Account Load (0.6ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 4416 LIMIT 1
[2017-11-22 15:03:21.624] Completed 400 Bad Request
View aa.liquid
{% assign is_self_referral_by_email = false %}
{% if advocate_info.email != blank and friend_info.email != blank %}
{% assign is_similar = advocate_info.email | similar_to_email: friend_info.email %}
{% assign plus_in_fr_email = friend_info.email | regexp_captures: '(\+[\d\w]+)?\@' %}
{% assign plus_in_ad_email = advocate_info.email | regexp_captures: '(\+[\d\w]+)?\@' %}
{% assign fr_email = friend_info.email | remove: plus_in_fr_email[0] %}
{% assign ad_email = advocate_info.email | remove: plus_in_ad_email[0] %}
{% if fr_email != blank and ad_email != blank %}
{% if is_similar or fr_email == ad_email %}
{% assign is_self_referral = true %}
View active_record.rb
module Datagrid
module Drivers
class ActiveRecord < AbstractDriver #:nodoc:
def self.match?(scope)
return false unless defined?(::ActiveRecord)
if scope.is_a?(Class)
scope.ancestors.include?(::ActiveRecord::Base)
else
scope.is_a?(::ActiveRecord::Relation)
View zz.diff
<div class="popup is-terms is-<%= with_overlay ? 'fixed' : claim_page_layout %>" data-popup="terms">
<div class="popup-close" data-toggle="terms">&times;</div>
<div class="popup-title">Terms &amp; Conditions</div>
+ <% if view_name == "advocate_share_page" %>
{% capture terms_and_conditions_copy %}
<p>
To qualify for a promo code, the referred person must (i) be a new customer, (ii) use a referral link to obtain the promo code and (iii) make a purchase on [[ site_url ]] in an amount greater than the minimum amount specified in the referral offer prior to the promo code's expiration. Referring customers will receive a referral credit in their [[ site_url ]] account after the referral is confirmed and the referral credit is approved by a customer service member. Customers are limited to referring two people per household. Referring customers may only earn one referral credit per referred person. In the event a referred person returns a purchased item and their lifetime order value decreases b