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 AutoresponderReaction < ActiveRecord::Base | |
### Modules ### | |
include Jobs::DatabaseQueue | |
### Constants ### | |
### Relations ### |
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
#!/bin/bash | |
pw=`curl -k -2 https://mail.drh.net/cgi-bin/get_password.cgi 2> /dev/null | head -3 | tail -1 | cut -d ' ' -f 3` | |
echo -n "$pw" | pbcopy | |
echo -n "$pw" |
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 'net/ssh/gateway' | |
namespace :jobs do | |
task :create_port_tunnel do | |
# Make sure the use rhas specified where we're connecting. | |
(username, hostname) = ENV["REMOTE_HOST"].to_s.split("@", 2) | |
if [ username, hostname ].any? &:blank? | |
puts "Please specify env var REMOTE_HOST containing a hostname like 'bob@example.com'." | |
exit 1 |
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
javascript: (function () { | |
var hasYouTube = function (url) { | |
return url.indexOf("youtube.com/") >= 0; | |
}; | |
var redirect = function (url) { | |
if ( url.indexOf("youtube.com/watch?") >= 0 ) { | |
window.location.href = url.replace(/\/watch\?/, "/watch_popup?"); | |
return true; | |
} else if ( url.indexOf("youtube.com/embed/") >= 0 ) { |
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 JustEchoSomethingFun_20140805211326 < GreenArrow::Migration | |
# The `before_up` method runs the specified command or Ruby block. If a shell | |
# command returns non-success or if the Ruby command returns false then the | |
# migration chain will not be run. The `before_up` logic is executed before | |
# an UP migration is executed, but not before a DOWN. | |
### before_up "ls /" | |
### before_up "echo 'Hello, world!'" | |
### before_up { [ 1, 2, 3 ].include? 2 } |
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 MigrateOldCreditTrackingData < ActiveRecord::Migration | |
def up | |
if ActiveRecord::Base.connection.tables.include? "credit_usage_daily_log" | |
execute <<-SQL | |
INSERT INTO s_credit_daily_usages ( date, organization_id, name, num_subscribers, num_users, credits ) | |
SELECT date::date, id, MAX(name), MAX(num_subscribers), MAX(num_users), MAX(credits) | |
FROM credit_usage_daily_log | |
WHERE date::date NOT IN (SELECT date FROM s_credit_daily_usages) | |
GROUP BY id, date::date; |
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 'active_support/core_ext/kernel/reporting' | |
require 'active_support/core_ext/module/aliasing' | |
require 'monitor' | |
# This is my variation on Tom Meier's monkey-patch to fix a problem in Rails | |
# I've run into with RSpec. I've tweaked it a bit to use `alias_method_chain` | |
# instead of just overloading the original method and copying its code. | |
# | |
# See the original Gist here: | |
# |
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
# The following tables will be initialized when the testing framework starts up. | |
input: | |
ss_banned_emails: | |
- | |
banid: 1 | |
emailaddress: "ace@drh.net" | |
list: "g" | |
bandate: 1405079491 | |
- | |
banid: |
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
<?php | |
define('GAS_BASE_URL', 'http://localhost:3000/api'); | |
define('GAS_API_KEY', '1:2768cac8a813c4419f167749e58219bfe4bca2d7'); | |
function greenarrow_studio_create_campaign($params) { | |
// Gather parameters needed to communicate with GA Studio. | |
$listID = $params['mailing_list_id']; | |
$url = GAS_BASE_URL.'/v2/mailing_lists/'.$listID.'/campaigns'; | |
$ch = curl_init($url); |
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 ReplaceNewlinesInLinks < ActiveRecord::Migration | |
def up | |
# Prior to this version, links could have newlines in them. We'll strip | |
# those out for any that are already in the database. | |
#execute <<-SQL | |
# --UPDATE s_links SET url = regexp_replace(url, '[\r\n]', '') WHERE url ~ '[\r\n]'; | |
#SQL | |
end |