Skip to content

Instantly share code, notes, and snippets.

View swalberg's full-sized avatar

Sean Walberg swalberg

View GitHub Profile
def can_delete?
return false unless key == "salary" && propable_type == "Employee"
# were there any accruals after this?
propable.accruals.where("date > ?", date).empty?
end
# save some typing from having to run rake test:blah TEST=something, or run an individual test
runt () {
if [ "x$1" == "x" ]; then
echo "runt FILE [what to pass to -n //]";
return;
fi;
if [ "x$2" == "x" ]; then
ruby -Itest $1;
else
ruby -Itest $1 -n "/$2/";
require 'stalker'
include Stalker
require 'newrelic_rpm'
NewRelic::Agent.manual_start :app_name => 'Wave Payroll', :agent_enabled => true
job 'email.new_user' do |args|
user = User.find(args["user_id"])
UserMailer.welcome_email(user).deliver
UserMailer.notify_admin(user).deliver
end
#!/usr/bin/perl
###########################################################################
##### #
##### check_cert.pl -- check HTTPS, IMAPS, LDAPS or SMTP (with #
##### STARTTLS) certificate expiration and, optionally, naming. #
##### #
############| mike ryan -- 02/03/06, 14:15 |#########
use 5.6.1;
use strict;
module ActsAsHistorical
extend ActiveSupport::Concern
included do
end
module ClassMethods
def acts_as_historical(options = {})
has_many :histories, :as => :historical, :dependent => :destroy
include MyInstanceMethods
# I'm proposing a few changes to the property system:
#
# 1. Instead of specifying the has_many and include, change it to a has_properties (like an acts_as_* plugin)
# Then we also configure the names of properties that need multiple instances, which gets it out of the controller.
# (I've already implemented this part locally and I think it looks a lot nicer)
#
# 2. On the first use of an object's properties, load all the object's properties into memory and
# operate on that cache, writing through to disk if need be. Editing employees, employers, and
# running payroll, all make use of multiple properties and this should be more efficient.
#
@swalberg
swalberg / gist:2955754
Created June 19, 2012 18:29
ssh autocompletion
function _ssh_completion() {
perl -ne 'print "$1 " if /^Host (.+)$/' ~/.ssh/config
}
complete -W "$(_ssh_completion)" ssh
SeanWalbergsMacBookPro:versapay(master) $ rake test
/Users/sean/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby -I"lib:lib:test" -I"/Users/sean/.rvm/gems/ree-1.8.7-2012.02/gems/rake-0.9.2.2/lib" "/Users/sean/.rvm/gems/ree-1.8.7-2012.02/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/**/*_test.rb"
Loaded suite /Users/sean/.rvm/gems/ree-1.8.7-2012.02/gems/rake-0.9.2.2/lib/rake/rake_test_loader
Started
.......EEEEE.......
Finished in 0.014907 seconds.
1) Error:
test_creating_a_credit_card_link(HelperTest):
RuntimeError: In order to use #url_for, you must include routing helpers explicitly. For instance, `include Rails.application.routes.url_helpers
require 'rubygems'
require 'aws/s3'
require 'base64'
# Override the authorization header
module AWS
module S3
class Connection #:nodoc:
def authenticate!(request)
ignore = Authentication::Header.new(request, access_key_id, secret_access_key)
debian-squeeze64:vagrant((6495e5f...) $%|BISECTING) $ git bisect run rake test:reports
running rake test:reports
/usr/local/rvm/rubies/ree-1.8.7-2012.02/bin/ruby -I"lib:test" -I"/vagrant/vendor/gems/ruby/1.8/gems/rake-0.9.2.2/lib" "/vagrant/vendor/gems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/reporting/**/*_test.rb"
Loaded suite /vagrant/vendor/gems/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader
Started
.......................................
Finished in 36.556862 seconds.
39 tests, 740 assertions, 0 failures, 0 errors
6495e5f8b1014d2b159436d01655b2727e17a856 was both good and bad