Skip to content

Instantly share code, notes, and snippets.

View zachhale's full-sized avatar
🚴‍♂️
Riding my bike

Zach Hale zachhale

🚴‍♂️
Riding my bike
View GitHub Profile
@zachhale
zachhale / payflow_recurring.rb
Created March 10, 2010 20:45
Class extension for ActiveMerchant's PayPalGateway to add recurring billing code.
# http://blog.vuzit.com/2008/08/01/paypal-website-payments-pro-us-with-recurring-billing-and-activemerchant/
# The MIT License
#
# Copyright (c) 2008 Vuzit.com, Chris Cera, Tobias Luetke
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@zachhale
zachhale / zerigo_to_aws_route53.rb
Created February 22, 2017 20:19 — forked from crashburn65/zerigo_to_aws_route53.rb
quick and dirty ruby script to copy dns from zerigo to amazon aws route 53 (route53). allows users to migrate ALL zones from zerigo over to Route53
#!/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
require 'rubygems'
require 'zerigo_dns'
require 'route53'
Zerigo::DNS::Base.user = 'username@email.com'
Zerigo::DNS::Base.api_key = 'yourkeyhere'
# iterate through all domain names
{ scopeName = 'source';
patterns = (
{ name = 'source.invalid.trailing-whitespace';
match = '((?<=[^\s\t])[\t\s]*)$';
captures = { 1 = { name = 'invalid.trailing-whitespace'; }; };
},
);
}
sudo vim /Library/LaunchDaemons/org.redis.redis-server.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.redis.redis-server</string>
<key>Program</key>
require 'erb'
@user = "Zach"
template = <<-TEMPLATE
Howdy <%= @user %>!
TEMPLATE
ERB.new(template).result(binding)
class Hash
def requires!(*args)
args.flatten.each do |arg|
raise ArgumentError, "#{arg} is required" unless has_key?(arg)
end
end
end
task :generate_static_pages => :environment do
ActionController::Dispatcher.define_dispatcher_callbacks(true) # same as config.cache_classes = true
class PreGenerateController < ApplicationController
layout 'secure'
def show
render :action => params[:id]
end
end
# requires rails environment to be loaded
include ActionView::Helpers::UrlHelper
include ActionController::UrlWriter
include ActionView::Helpers::TagHelper
default_url_options[:host] = 'www.website.com'
alias ss="/rails/.shortcuts/ss.rb"
#!/usr/bin/env ruby
require 'rubygems'
require 'daemon-spawn'
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
class DelayedJobWorker < DaemonSpawn::Base
def start(args)
ENV['RAILS_ENV'] ||= args.first || 'development'
Dir.chdir RAILS_ROOT