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
a.button, button.button { | |
font-family: "Lucida Grande", Tahoma, Arial, sans-serif; | |
float: left; | |
margin: 0 7px 0 0; | |
padding: 0px; | |
background: transparent; | |
text-decoration: none; | |
border: none; | |
display: block; |
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
<style type="text/css"> | |
body { | |
background: black; | |
} | |
</style> |
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 self.send_update_to(user, date = ActivityUpdateMailer.current_or_next_update) | |
# blah blah | |
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
convert: function(amount, from, to) { | |
$.get("/currency_conversion/" + amount + "/from/" + from + "/to/" + to, function(response) { | |
parseFloat(response); | |
}); | |
} |
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 blah | |
begin | |
Timeout.timeout(1) do | |
sleep(2) | |
end | |
rescue Exception => e | |
return {:foo => :bar} | |
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
# Apache sets an environment variable called USER_GEO on every request | |
# with a country code for where the IP is from | |
def redirect_for_geo_partners | |
return unless geo_partner = Partner.find_by_country(env['USER_GEO']) | |
# Store the request path | |
desired_path = request.path | |
if logged_in? | |
if on_partner_site? |
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 redirect_for_geo_partner | |
return unless request.env['GEOIP_COUNTRY_CODE'] && geo_partner = Partner.find_by_country(request.env['GEOIP_COUNTRY_CODE']) | |
desired_path = request.path | |
if logged_in? | |
if on_partner_site? | |
if current_user.referable.nil? || (current_user.referable && !current_user.referable.kind_of?(Partner)) | |
# This user has no partner but is on a partner site. Kick them back to app. | |
redirect_to "http://#{HOST}" + desired_path |
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 self.get_product(sku, params = {}) | |
params.reverse_merge!({ | |
'advertiser-ids' => 'joined', | |
'advertiser-sku' => sku, | |
'website-id' => COMMISSION_JUNCTION_PID | |
}) | |
Nokogiri.XML(get('https://product-search.api.cj.com/v2/product-search?', params)) | |
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
[6] pry(main)> cd Blog | |
[7] pry(Blog):1> show-method classify_blogs! | |
Error: The method 'classify_blogs!' could not be found. Type `show-method --help` for help. | |
[8] pry(Blog):1> show-method classify_blogs | |
From: /Users/joe/.rvm/gems/ree-1.8.7-2011.03@ss/gems/pry-0.9.8.1/lib/pry/method.rb @ line 300: | |
Number of lines: 14 | |
Owner: #<Class:Blog(id: integer, url: string, feed_url: string, canonical_url: string, title: string, description: text, average_daily_visits: decimal, average_daily_visitors: decimal, average_daily_pageviews: decimal, platform_id: string, created_at: datetime, updated_at: datetime, vertical_id: integer, publisher_id: integer, review_status: string, majority_country: string, cost: integer, auth_username: string, foreign_id: string, auth_token: string, auth_secret: string, author_name: string, type: string, screen_name: string, full_name: string, followers_count: integer, stats_updated_at: datetime, ga_status: string, open_offers_count: integer, approved_offers_count: integer, premium: boolean, d |
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
select @rn:=@rn+1 as rank, referrals | |
from ( | |
select count(referrer_id) as referrals, referrer_id from users | |
where referrer_id is not null | |
group by referrer_id | |
order by referrals desc) t1, (select @rn:=0) t2 | |
-- Giving output like this | |
/* rank referrals | |
1 100 |
OlderNewer