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
<a href="http://twitter.com/share" | |
data-url="{{ tld }}/{{ current_page }}?analytics=tracking_here" | |
class="twitter-share-button" | |
data-text="{{ offer.reward }} Rakeback at {{ offer.name }}" | |
data-count="vertical" | |
data-via="your_twitter_name">Tweet</a> | |
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> |
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
- link_to "http://certify.gpwa.org/verify/pokeraffiliatesolutions.com/", :onlick => "return GPWAVerificationPopup(this)", :id => "GPWASeal" do | |
= image_tag "http://certify.gpwa.org/seal/pokeraffiliatesolutions.com/", :onerror => "this.width=0; this.height=0;" |
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
# Adds a User ID to a sorted set using the current timestamp as the score | |
redis = Redis.new | |
redis.zadd("active-users", Time.now.to_i, user.id) | |
# Get all User IDs with a timestamp within the timestamp range | |
user_ids = redis.zrangebyscore("active-users", 15.minutes.ago.to_i, Time.now.to_i) | |
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
# Inside the controller code that fetches the logged in user for every request | |
# Note: Trying to call EXPIRE against a key that already has an associated timeout will not change the timeout of the key, but will just return 0 | |
redis = Redis.new | |
minutes = 5 | |
seconds = minutes * 60 | |
redis.multi do | |
redis.sadd("active-users", user.id) | |
redis.expire("active-users", seconds) |
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
class Dream | |
def inception(idea) | |
time_multiplier = 1 | |
return enter_dream(idea, time_multiplier) | |
end | |
def enter(idea, time_multiplier) | |
time_multiplier = time_multiplier / 2 | |
if idea.has_taken_root? |
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
module PAS | |
RedisConfig = File.join(Rails.root, "config", "redis.yml") | |
def self.redis | |
return @redis if @redis | |
@redis = Redis.new(YAML::load(File.open(RedisConfig))) | |
end | |
def self.redis=(redis) | |
@redis = redis |
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
module ActionMailer | |
class Base | |
def template_path | |
File.join(template_root, mailer_name) | |
end | |
end | |
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
map.resources :users do |users| | |
users.resources :events | |
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
jose:~ → rvm gemset copy ree-1.8.7-2010.01 ree-1.8.7-2010.02 | |
info: Copying gemset from ree-1.8.7-2010.01 to ree-1.8.7-2010.02 | |
info: Making gemset for ree-1.8.7-2010.02 pristine. | |
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError) | |
ERROR: Failed to build gem native extension. | |
/Users/jose/.rvm/rubies/ree-1.8.7-2010.01/bin/ruby extconf.rb | |
creating Makefile |
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
require 'rack-rewrite' | |
DOMAIN = 'www.production-hacks.com' | |
# Redirect to the www version of the domain in production | |
use Rack::Rewrite do | |
r301 %r{.*}, "http://#{DOMAIN}$&", :if => Proc.new {|rack_env| | |
rack_env['SERVER_NAME'] != DOMAIN && ENV['RACK_ENV'] == "production" | |
} | |
end |