View reward.rb
def void!
self.update_attribute(:status, BASE_STATUSES[:voided])
# TODO: Need to better figure out which redeem activity to modify...
# For now, see if there was one around the time of the reward creation and void that if found
[:redeem, :referral].each do |r|
void_activities = offer.activities.by_action(r).by_date_times(created_at..(created_at + 5.minutes))
unless void_activities.empty?
activity = void_activities.first
logger.info("Reward#void! reward #{id} voided, voiding #{activity.action} activity: #{activity.id}")
activity.update_attribute(:action, "#{r}_voided")
View dom.rb
class Generator
class Tag
attr_accessort :name, :children, :level
def initialize(name, level = 0, &block)
@name = name
@level = level
@children = []
instance_eval(&block)
end
View forwardable.rb
def self._delegator_method(obj, accessor, method, ali)
accessor = accessor.to_s unless Symbol === accessor
if Module === obj ?
obj.method_defined?(accessor) || obj.private_method_defined?(accessor) :
obj.respond_to?(accessor, true)
accessor = "#{accessor}()"
end
method_call = ".__send__(:#{method}, *args, &block)"
View site_nested_controller.rb
# Loads @site into controller and check if current user is authorized
# to view this site.
module SiteNestedController
extend ActiveSupport::Concern
included do
class_attribute :site_param
self.site_param = :site_id
before_action :require_user
View df.diff
diff --git a/app/models/visitor_offer.rb b/app/models/visitor_offer.rb
index 1d4f8f2807..e72771ad20 100644
--- a/app/models/visitor_offer.rb
+++ b/app/models/visitor_offer.rb
@@ -307,20 +307,23 @@ class VisitorOffer < BaseModel
end
def click_reward_in_email!
- return click_reward if click_reward
- return if sample?
View log.log
> r!;ShareEmail.perform(Offer.last, 'A A <alexey.vlasov@gmail.com>', nil, nil, nil, nil)
Reloading...
Offer Load (0.3ms) SELECT `offers`.* FROM `offers` ORDER BY `offers`.`id` DESC LIMIT 1
Campaign Load (0.3ms) SELECT `campaigns`.* FROM `campaigns` WHERE `campaigns`.`id` = 37228 LIMIT 1
Site Load (0.3ms) SELECT `sites`.* FROM `sites` WHERE `sites`.`id` = 2901 LIMIT 1
Person Load (0.3ms) SELECT `people`.* FROM `people` WHERE `people`.`site_id` = 2901 AND `people`.`email` = 'alexey.vlasov@gmail.com'
CustomAttribute Load (0.3ms) SELECT `custom_attributes`.* FROM `custom_attributes` WHERE `custom_attributes`.`foreign_id` = 18425477 AND `custom_attributes`.`model` = 'Person'
Mailgun Batch Email Validation: passed - 1, failed - 0, total - 1
Account Load (0.2ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 4416 LIMIT 1
Person Load (0.5ms) SELECT `people`.* FROM `people` INNER JOIN `offer_shares` ON `people`.`id` = `offer_shares`.`person_id` WHERE `offer_shares`.`type` IN ('Em
View fuzzy_string_matcher_spec.rb
require "spec_helper"
describe FuzzyStringMatcher do
context ".similar?" do
RSpec::Matchers.define :be_similar do
match {|val| FuzzyStringMatcher.similar?(*val) }
end
FALSE_POSITIVE = <<-HEREDOC.lines.reject(&:blank?).map {|x| x.strip.split(", ") }
greg.dellolio, doug.dellolio
View New specs API.md

Singleton Factories

Ability to limit data generation to certain site, campaign or offer without caring explicitly that data is bound to same campaign or site etc.

Singleton values:

  • site
  • campaign
  • offer
View gist:341836bcc2917e959912cda3c3782311
$ cap -r web production utils:execute COMMAND='ls -hla /home/rails/talkable/current/log/nginx-access.log-2016080*'
web02.production: -rw-r--r-- 1 rails root 274M Aug 1 06:48 /home/rails/talkable/current/log/nginx-access.log-20160801.gz
web02.production: -rw-r--r-- 1 rails root 253M Aug 2 06:36 /home/rails/talkable/current/log/nginx-access.log-20160802.gz
web02.production: -rw-r--r-- 1 rails root 271M Aug 3 06:32 /home/rails/talkable/current/log/nginx-access.log-20160803.gz
web02.production: -rw-r--r-- 1 rails root 255M Aug 4 06:39 /home/rails/talkable/current/log/nginx-access.log-20160804.gz
web02.production: -rw-r--r-- 1 rails root 256M Aug 5 06:27 /home/rails/talkable/current/log/nginx-access.log-20160805.gz
web02.production: -rw-r--r-- 1 rails root 250M Aug 6 06:52 /home/rails/talkable/current/log/nginx-access.log-20160806.gz
web02.production: -rw-r--r-- 1 rails root 248M Aug 7 06:52 /home/rails/talkable/current/log/nginx-access.log-20160807.gz
web02.production: -rw-r--r-- 1 rails root 297M Aug 8
View markdown.snippets
snippet cc "code"
``` ${1}
```
endsnippet
snippet rb "rb"
``` ruby
${1}
```
endsnippet