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
View gist:a097ef3d7df06c0045cc6ed335627805
diff --git a/spec/js_routes/rails_routes_compatibility_spec.rb b/spec/js_routes/rails_routes_compatibility_spec.rb
index ff0a480..6f027f7 100644
--- a/spec/js_routes/rails_routes_compatibility_spec.rb
+++ b/spec/js_routes/rails_routes_compatibility_spec.rb
@@ -93,6 +93,14 @@ describe JsRoutes, "compatibility with Rails" do
it "should support single route mapping" do
expect(evaljs("Routes.support_path({page: 3})")).to eq(routes.support_path(:page => 3))
end
+
+ describe "anonymous" do
View sweeperzz.rb
module Check_position
def check_position(x, y)
if @board[x][y] == 'b'
return 'b'
else
# Counter can be cached.
# That is optional to do but is a big +
counter(x, y)
end
end
View action_mailer_optional_tls.rb
require 'open-uri'
require 'net/https'
module Net
class HTTP
alias_method :original_use_ssl=, :use_ssl=
def use_ssl=(flag)
# Ubuntu
if File.exists?('/etc/ssl/certs')