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
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
# 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
# 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
- 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
<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
<iframe src="http://www.facebook.com/plugins/like.php?href={{ current_page_url | html_escape }}&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe> |
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
# This file is used by Rack-based servers to start the application. | |
require ::File.expand_path('../config/environment', __FILE__) | |
require 'resque/server' | |
run Rack::URLMap.new \ | |
"/" => Mailto::Application, | |
"/resque" => Resque::Server.new |
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
git log <branch1>..<branch2> --author=<pattern> |
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
#!/bin/bash | |
############################################################################ | |
# Script to open a directory in TextMate excluding certain directories that | |
# tend to slow down the Find in Project... function. | |
# | |
# Place in an executable loctation with a name of your choosing. | |
# I use `ate' and have it in ~/Local/bin (which has been added to $PATH) | |
############################################################################ |