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
INSERT | |
INTO promotion_attempts (audience_member_id, state, mailing_id) | |
SELECT memberships.audience_member_id, 'ignorant', 18591 | |
FROM memberships | |
INNER JOIN audience_members ON memberships.audience_member_id = audience_members.id | |
WHERE memberships.audience_list_id IN (7310) | |
AND (audience_members.suppressed IS NULL OR audience_members.suppressed = 0) | |
AND audience_members.email NOT IN ( | |
SELECT promotion_attempts.email | |
FROM promotion_attempts |
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
DROP PROCEDURE IF EXISTS mailing_prevent_resend; | |
DELIMITER // | |
CREATE PROCEDURE mailing_prevent_resend | |
(target_mailing_id INT, prevent_resend BOOLEAN, target_promotion_id INT) | |
BEGIN | |
DROP TEMPORARY TABLE IF EXISTS promotion_attempt_emails; |
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
require 'rubygems' | |
require 'mechanize' | |
require 'logger' | |
require 'band' | |
agent = WWW::Mechanize.new | |
agent.max_history = 1 | |
agent.user_agent_alias = 'Mac Safari' | |
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.disabled | |
find(:all, :conditions => {:disabled => true}) | |
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
class Module | |
def bool_accessor(attribute) | |
attr_accessor attribute | |
define_method(attribute.to_s + "?") do | |
!!send(attribute) | |
end | |
end | |
end | |
class Bar |
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
require 'ostruct' | |
# http://en.wikipedia.org/wiki/Sudoku | |
wiki = | |
"53 7 | |
6 195 | |
98 6 | |
8 6 3 | |
4 8 3 1 | |
7 2 6 |
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 DatabaseReport | |
def initialize(io, step_mother, options={}) | |
end | |
def feature_executing(feature) | |
puts "It begins....#{feature.file}" | |
end | |
def header_executing(header) |
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
role :mail, *(1..8).map { |n| "mailserver#{n}.yourdomain.com" } | |
desc "grab postfix stats" | |
task :postfix_stats, :roles => :mail do | |
sudo "ls /var/spool/postfix/incoming|wc -l" | |
sudo "ls /var/spool/postfix/active|wc -l" | |
sudo "ls -R /var/spool/postfix/deferred|wc -l" | |
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
require 'rubygems' | |
require 'hpricot' | |
class String | |
def to_absolut | |
doc = Hpricot(self) | |
(doc/"a").each do |link| | |
link["href"] = "http://hi.com/" + link["href"] | |
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
DROP PROCEDURE IF EXISTS mailing_prevent_resend; | |
DELIMITER // | |
CREATE PROCEDURE mailing_prevent_resend | |
(target_mailing_id INT, all_audience_user_id INT, prevent_resend BOOLEAN, target_promotion_id INT, force_reconfirm BOOLEAN) | |
BEGIN | |
DROP TEMPORARY TABLE IF EXISTS resulting; |