Skip to content

Instantly share code, notes, and snippets.

View ahk's full-sized avatar

Andrew Hay Kurtz ahk

  • Penumbra
  • Oakland, CA
View GitHub Profile
namespace :parallel do
def lib_path
File.join(File.dirname(__FILE__), '../../', 'vendor/gems/parallel_tests-0.3.2/')
end
def run_in_parallel(cmd, options)
count = (options[:count] ? options[:count].to_i : nil)
system "#{File.join(lib_path, 'bin', 'parallel_test')} --exec '#{cmd}' -n #{count}"
end
require 'formula'
require 'hardware'
class Postgresql < Formula
@homepage='http://www.postgresql.org/'
@url='http://ftp2.uk.postgresql.org/sites/ftp.postgresql.org/source/v8.2.14/postgresql-8.2.14.tar.gz'
@md5='f1fc189eb0ed36d7f3e7e1649408725f'
depends_on 'readline'
depends_on 'libxml2' if MACOS_VERSION < 10.6 #system libxml is too old
class Grid < ActiveRecord::Base
has_many :rows
has_many :columns
has_many :cells, :through => :rows
accepts_nested_attributes_for :rows,
:allow_destroy => true,
:reject_if => lambda {|a| a[:description].blank? }
accepts_nested_attributes_for :columns,
:allow_destroy => true,
#!/usr/bin/env ruby
# Simple executable wrapper for Surrender's server/client dispatching
this_file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
bin_dir = File.dirname this_file
exec_file = File.join bin_dir, '..', 'surrender.rb'
args = ARGV.join ' '
exec "ruby #{exec_file} #{args}"
ln -s ~/.dotfiles/.profile ~/.profile
ln -s ~/.dotfiles/.bash_profile ~/.bash_profile
ln -s ~/.dotfiles/.bashrc ~/.bashrc
ln -s ~/.dotfiles/.ackrc ~/.ackrc
ln -s ~/.dotfiles/.gemrc ~/.gemrc
ln -s ~/.dotfiles/.gitconfig ~/.gitconfig
ln -s ~/.dotfiles/.gitshrc ~/.gitshrc
ln -s ~/.dotfiles/.irbrc ~/.irbrc
ln -s ~/.dotfiles/.rdebugrc ~/.rdebugrc
class ActivityMailer < ActionMailer::Base
def reply(comment, deliver_to_user)
@comment = comment
mail(:subject => I18n.t(:'activity_mailer.subject', :project_name => project.name, :activity_name => response.activity.short_name),
:from => "no-reply@example.com",
:to => deliver_to_user.email)
end
def message(app_message)
1) An ActivityMailer class receiving notify_researchers With test deliveries#notify_response_author should be from no-reply@example.com
Failure/Error: ActivityMailer.deliver_reply(@comment, @participant).from.should == ["no-reply@example.com"]
ArgumentError:
wrong number of arguments (0 for 1)
# /Users/revelation/.rvm/gems/ruby-1.8.7-p249@revelation-project-rails3/gems/actionmailer-3.0.5/lib/action_mailer/delivery_methods.rb:83:in `message'
# /Users/revelation/.rvm/gems/ruby-1.8.7-p249@revelation-project-rails3/gems/actionmailer-3.0.5/lib/action_mailer/delivery_methods.rb:83:in `wrap_delivery_behavior!'
# /Users/revelation/.rvm/gems/ruby-1.8.7-p249@revelation-project-rails3/gems/actionmailer-3.0.5/lib/action_mailer/base.rb:643:in `mail'
# ./app/models/activity_mailer.rb:72:in `reply'
# /Users/revelation/.rvm/gems/ruby-1.8.7-p249@revelation-project-rails3/gems/actionpack-3.0.5/lib/abstract_controller/base.rb:150:in `send_action'
# /Users/revelation/.rvm/gems/rub
@ahk
ahk / gist:953932
Created May 3, 2011 18:41
find and replace strings in glob
# $@ and $* are the same without quotes, but with quotes
# $* is one quoted string containing all args, $@ is one quoted string
# for each arg. This handles spaces in filenames correctly.
FINDSTR=${1};
REPSTR=${2};
shift;
shift;
echo "replace ${FINDSTR} with ${REPSTR} in" "$@"
for FN in "$@"
@ahk
ahk / gist:972137
Created May 14, 2011 11:40
redirect traffic on port 80 to port 8080 with iptables
# redirect traffic on port 80 to port 8080 with iptables
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
$ cabal-dev install --verbose
/usr/local/bin/cabal --numeric-version
/usr/local/bin/ghc-pkg --version
Using ghc-pkg 7.0.4
/usr/local/bin/cabal --version
/usr/local/bin/cabal --config-file=/Users/andrew/Code/misc/haskell/supercollider-test/cabal-dev/cabal.config install --verbose=2
Reading available packages...
Resolving dependencies...
cabal: There is no installed version of base