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 Klass | |
def self.build_map | |
@@map = "hi" | |
end | |
self.build_map | |
def self.use_it | |
puts @@map | |
end | |
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
bright_cove_content_parts = ContentPart.find(:all, :conditions=>["content like '%%c.brightcove.com%%'"]) | |
bright_cove_content_parts.collect {|cp| cp.template_part.name}.uniq |
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
bright_cove_content_parts = ContentPart.find(:all, :conditions=>["content like '%%c.brightcove.com%%'"]) | |
def parse_it(x) | |
x | |
end | |
map = {} | |
bright_cove_content_parts.each do |bc_cp| | |
map[bc_cp.version.content_id] ||= {} | |
map[bc_cp.version.content_id][bc_cp.template_part_id] = parse_it(bc_cp.content) | |
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
video_pagination_layouts = PaginationLayout.find(:all, | |
:conditions => ["content like '%%Video Review%%'"], | |
:include => [:content_template]) | |
all_cts = [] | |
all_cts += ContentTemplate.find_all_by_landing_page_layout_id(video_pagination_layouts) | |
all_cts += video_pagination_layouts.collect {|vpl| vpl.content_template}.compact # just in case |
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
authkey.rb | |
authenticate!(key) | |
if success | |
response = [:status=>"success", :remaining_requests=>499] | |
else | |
response = [:status=>"failure", :remaining_requests=>499, :errors => [something]] | |
end | |
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
pets: | |
name | owner | |
-------------------- | |
spot | Dog | |
Rover | Dog | |
Fluffy | Cat | |
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 non_multi_dupes | |
non_multi_specs = Spec.find_all_by_is_multival(false).select{|x| parent = x.try(:parent); !parent.try(:is_multival)} | |
non_multi_sids = non_multi_specs.collect {|s| s.id} | |
# this sql will find all spec values grouped by product_id+spec_id where the count of this grouping is greater than 1 | |
sql = ["select * from spec_values where spec_id in (?) group by spec_id, product_id having (count(*) > 1)", non_multi_sids] | |
puts "about to do a beefy sql statement. Shouldn't take longer than 10 seconds or so." | |
single_dupe_svs = SpecValue.find_by_sql(sql) | |
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
before_save :check_for_blanks | |
... | |
def check_for_blanks | |
debugger | |
if (self.token.blank?) | |
self.token = ApiKey.generate_token | |
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
def check_for_blanks | |
defaults = ApiKey.new | |
self.attributes.each do |k, v| | |
self[k] == defaults[k] if v.blank? | |
end | |
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
Viewfinder Score : 8.25, 8.25 | |
Menu Score : 6, 6 | |
Viewfinder Score - Scaled : 7.67441860465116, 7.67441860465116 | |
Menu Score - Scaled : 3.04347826086957, 3.04347826086957 | |
Performance Metascore : 6.5805381117459, 1.70070078521717, 1.34244316044779 | |
Usability Metascore : 5.56540390658712, -0.0825331872914443 |
OlderNewer