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
=begin | |
Capistrano deployment email notifier for Rails 3 | |
Do you need to send email notifications after application deployments? | |
Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html. | |
Here is Rails 3 port of the notifier. | |
The notifier sends an email after application deployment has been completed. |
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 | |
echo "Backup started" `date` | |
APPLICATION_DIR=YOUR_APP_DIRECTORY_GOES_HERE | |
BACKUP_DIR=YOUR_BACKUP_DIRECTORY_GOES_HERE | |
cd ${APPLICATION_DIR} | |
heroku pgbackups:capture --expire | |
URL=`heroku pgbackups:url` | |
URL=${URL//\"/} | |
echo $URL | |
curl -o $BACKUP_DIR`date +"db_dump_%Y%m%d%H"` ${URL} |
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 -ex | |
# Create database.yml for a Ruby on Rails application | |
# Storing database.yml in a source code control system with its production database credentials creates a security risk. | |
# Using this script, you can take advantage of RightScale's secure credentials store | |
# and generate the file when an application server is launched. | |
# | |
# If this is a reboot skip this script. | |
if test "$RS_REBOOT" = "true" ; then | |
logger -t RightScale "Skip RB create database.yml." |
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
# Please refer to http://ctoinsights.wordpress.com/2011/10/17/running-distributed-cron-jobs-in-the-cloud/ | |
class DatabaseSemaphore < ActiveRecord::Base | |
validates_presence_of :name, :message => "can't be blank" | |
def self.open?(name, lock_duration = 600) | |
# only one requestor can get open semaphore at a time | |
# sempahore can be locked in a closed position for lock_duration in seconds | |
semaphore_open = false | |
now = Time.now | |
# insert record if it does not exist yet |
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 gist is documented at http://ctoinsights.wordpress.com/2011/11/26/running-heroku-workers-only-when-required/ | |
class HerokuManager | |
def heroku | |
@heroku ||= Heroku::API.new | |
end | |
def get_workers | |
heroku.get_ps(HEROKU_APP_NAME).body.count { |p| p["process"] =~ /worker\.\d?/ } | |
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
# Migrate records from a Trac database to LighthouseApp | |
require 'rubygems' | |
require 'sqlite3' | |
require 'lib/lighthouse.rb' # download from https://github.com/Caged/lighthouse-api | |
# Connect to Lighthouse API | |
Lighthouse.account = 'YOUR LIGHTHOUSE ACCOUNT' | |
Lighthouse.token = 'YOUR LIGHTHOUSE API TOKEN' | |
project = Lighthouse::Project.find(:all).first | |
puts "MIGRATING TICKETS TO PROJECT: #{project.name}" |
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
<script src="https://d3aa0ztdn3oibi.cloudfront.net/javascripts/ff.loyalty.widget.js" type="text/javascript"></script> | |
<iframe id="ff_member_iframe" style="width:760px;height:1045px;border:0" frameBorder="0"></iframe> | |
<script type="text/javascript"> | |
_ffLoyalty.initialize( "YOUR_ACCOUNT_ID" ); | |
_ffLoyalty.loadIframe({ email: "CUSTOMER_EMAIL", auth_token: "AUTH_TOKEN", auto_resize: true }); | |
</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
<script src="https://d3aa0ztdn3oibi.cloudfront.net/javascripts/ff.loyalty.widget.js" type="text/javascript"></script> | |
<iframe id="ff_member_iframe" style="width:760px;height:1045px;border:0" frameBorder="0"></iframe> | |
<script type="text/javascript"> | |
_ffLoyalty.initialize( "YOUR_ACCOUNT_ID" ); | |
_ffLoyalty.loadIframe({ auto_resize: true }); | |
</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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> | |
<html> | |
<head> | |
<title>LoyaltyPlus Member Page Sample</title> | |
<script src="https://d3aa0ztdn3oibi.cloudfront.net/javascripts/ff.loyalty.widget.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<h1>SINGLE SIGN-ON MEMBER PAGE SAMPLE</h1> | |
<?php | |
// get uuid and email |
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
<? | |
$secret_key = "SECRET_KEY"; | |
$params = array("email" => "CUSTOMER_EMAIL", "uuid" => "ACCOUNT_ID"); | |
ksort($params); | |
$string_to_hash = $secret_key; | |
foreach ($params as $key => $val) { | |
$string_to_hash .= $key.$val; | |
} | |
$params["sig"] = md5($string_to_hash); | |
$api_url = "http://loyalty.500friends.com/api/enroll.gif?"; |
OlderNewer