This file contains hidden or 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
#FIXME REFACTOR break this out, like, allot | |
def persist_posts(posts) | |
persisted = [] | |
NetworkPost.transaction do | |
persisted = posts.collect do |post| | |
klass = eval(self.type.to_s.gsub('Endpoint', '') + 'Post') | |
p = klass.handle_response(post) | |
next if p.nil? | |
p.network_endpoints << self unless p.network_endpoints.exists?(:id => self.id) | |
p.save |
This file contains hidden or 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 post_avatar(post) | |
if post.is_a?(Post) | |
link_to(image_tag(post.network.image_url, :class => "avatar zzz"), post.network.link_url, :class => "username avatar") | |
elsif post.is_a?(TwitterPost) | |
link_to(image_tag(post.from_user_avatar, :class => "avatar zzz post"), networks_twitter_twitter_user_twitter_posts_url(post.originating_network, twitter_user(post.data)['screen_name']), :class => 'twitter_user_profile avatar') | |
elsif post.is_a?(FacebookPost) | |
link_to(image_tag(post.from_user_avatar, :class => "avatar zzz post"), networks_facebook_facebook_user_facebook_posts_url(post.originating_network, post.data['from']['id']), :class => 'facebook_user_profile avatar') | |
elsif post.is_a?(GnipTwitterPost) | |
link_to(image_tag(post.from_user_avatar, :class => "avatar zzz post"), '#', :class => 'twitter_user_profile avatar') | |
elsif post.is_a?(GnipFacebookPost) |
This file contains hidden or 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
%w[test live].each do |mode| | |
define_method "#{mode}_validate_payment_profile" do | |
options = { | |
:customer_profile_id => self.cim_id, | |
:customer_payment_profile_id => self.get_cim_payment_profile[:payment_profile_id], | |
:validation_mode => :"#{mode}" | |
} | |
response = GATEWAY.validate_customer_payment_profile(options) |
This file contains hidden or 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 validate_payment_profile(options) | |
response = GATEWAY.validate_customer_payment_profile(options) | |
validation_hash = { | |
:success => (response.success? ? true : false), | |
:message => response.params["direct_response"]["message"] | |
} | |
return validation_hash | |
end |
This file contains hidden or 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 validate_payment_profile(params) | |
options = { | |
:customer_profile_id => self.cim_id, | |
:customer_payment_profile_id => self.get_cim_payment_profile[:payment_profile_id], | |
:validation_mode => :test | |
} | |
options.merge!(params) | |
response = GATEWAY.validate_customer_payment_profile(options) |
This file contains hidden or 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
gnip_rules.clear | |
rule_types.each do |rule_type| | |
existing_rules = rule_type.find_all_by_value(rule_values) | |
new_rules = (rule_values - existing_rules.map(&:value)).map{|value| rule_type.create(:value => value) } | |
gnip_rules << existing_rules + new_rules | |
end |
This file contains hidden or 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
var Obj = { | |
baz: function() { | |
alert("baz") | |
}, | |
} |
This file contains hidden or 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
0*x_1 + x_2 + x_3 + ... + x_29 = S_29 | |
- x_1 + x_2 + x_3 + ... + x_28 = S_28 | |
------------------------------------- | |
x_29 - x_1 = S_29 - S_28 | |
x_29 = S_29 - S_28 + x_1 |
This file contains hidden or 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 + 2 + 3 + ... + 100 = N | |
+ 100 + 99 + 98 + ... + 1 = N | |
----------------------------- | |
101 + 101 + 101 + ... + 101 = 2 * N | |
(101 * 100) / 2 = N |
This file contains hidden or 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
Code Review: | |
Tests: #50, #113, #122, #428, #456, #460 | |
Model: #114, #123, #124, #318, #327, #465, #491, #629, #56, #398 | |
* Model constraints / validation review: #103, #104, #163, #251, #346, #144 | |
Security: #58, #409, #116, #334, #409, #105, #615 | |
Performance: #64, #121, #136, #400, #408, #459, #484 | |
* Dependency Issues: #96, #173, #456 | |
* Frontend: #628 | |
Fault Tolerancy / Monitoring: #94, #167, #485, #101, #92 | |
Profanity Filter refactoring: #43, #126, #125 |