Skip to content

Instantly share code, notes, and snippets.

View swalberg's full-sized avatar

Sean Walberg swalberg

View GitHub Profile
#!/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;
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
# 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/";
def can_delete?
return false unless key == "salary" && propable_type == "Employee"
# were there any accruals after this?
propable.accruals.where("date > ?", date).empty?
end
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>Action Controller: Exception caught</title>
<style>
body { background-color: #fff; color: #333; }
body, p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
application helper:
def title(phrase, container=nil)
@page_title ||= phrase
content_tag(container, phrase) if container
end
layout:
<title><%= @page_title || "Default page title" %></title>
class LocalFormBuilder < ActionView::Helpers::FormBuilder
def label(method, text = nil, options = {})
#Check to see if text for this label has been supplied and humanize the field name if not.
text = text || method.to_s.humanize
#Get a reference to the model object
#Add any additional text that might be needed on the label
text += " <span class=\"text\">#{h options[:description]}</span>".html_safe if options[:description]
text += "<span class=\"required\">*</span>".html_safe if options[:required]
#Finally hand off to super to deal with the display of the label
app/controllers/webhooks/versapay_controller.rb:
class Webhooks::VersapayController < ApplicationController
check_versapay_signatures VERSAPAYSIGNINGKEY
...
end
from gem:
class ActionController::Base
ree-1.8.7-2011.03 :030 > PayrollRun.create
ArgumentError: wrong number of arguments (2 for 1)
from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/activerecord-3.1.2/lib/active_record/base.rb:508:in `initialize'
from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/activerecord-3.1.2/lib/active_record/base.rb:508:in `new'
from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@rails31/gems/activerecord-3.1.2/lib/active_record/base.rb:508:in `create'
from (irb):30
ree-1.8.7-2011.03 :031 > PayrollRun.new
=> #<PayrollRun id: nil, employer_id: nil, start: nil, finish: nil, created_at: nil, updated_at: nil, status: "pending">
>> :foo.object_id
=> 302268
>> :foo.object_id
=> 302268
>> "foo".object_id
=> 2165056460
>> "foo".object_id
=> 2165052320