# manual way
Minitest.run(args)
# magic way
require 'minitest/autorun'
# or
Minitest.autorun
def delete_failed_job_if | |
redis = Resque.redis | |
(0...Resque::Failure.count).each do |i| | |
string = redis.lindex(:failed, i) | |
break if string.nil? | |
job = Resque.decode(string) | |
should_delete_job = yield job | |
next unless should_delete_job |
panic: runtime error: invalid memory address or nil pointer dereference | |
[signal 0xb code=0x1 addr=0x0 pc=0x0] | |
goroutine 10 [running]: | |
runtime.gopanic(0x5a7020, 0xc8200101b0) | |
/usr/local/go/src/runtime/panic.go:461 +0x3e6 | |
runtime.panicmem() | |
/usr/local/go/src/runtime/panic.go:42 +0x49 | |
runtime.sigpanic() | |
/usr/local/go/src/runtime/sigpanic_unix.go:24 +0x2ba |
drew:~/projects/prj$ zeus start | |
Starting Zeus server v0.15.5.rc1 | |
[ready] [crashed] [running] [connecting] [waiting] | |
boot | |
└── default_bundle | |
├── development_environment | |
│ └── prerake | |
└── test_environment | |
└── test_helper |
def method_name | |
state.thing_that_throws | |
rescue | |
state.error | |
ensure | |
state.thing | |
state | |
end |
<%= CSV.generate do |csv| %> | |
<% csv << ["All Orders"] %> | |
<% csv << [] %> | |
<% total = 0.0 %> | |
<% orders.each do |order| %> | |
<% csv << [order.id, order.subtotal, order.tax, order.shipping, order.total] %> | |
<% total += order.total %> | |
<% end %> | |
<% csv << [] %> | |
<% csv << ["Total", total] %> |
# Imagine we have a form that only sets user name for verified users | |
class Form | |
include ActiveModel::Model | |
attr_accessor :name | |
def save(user) | |
user.name = name if user.verified? | |
end | |
end |
require 'active_record' | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
ActiveRecord::Schema.define do | |
create_table :somethings, force: true do |t| | |
t.integer :age | |
t.integer :count | |
end | |
end | |
class Something < ActiveRecord::Base |
$ ruby poodr.rb | |
poodr.rb:20:in `prepare_trip': undefined method `each' for nil:NilClass (NoMethodError) | |
from poodr.rb:6:in `block in prepare' | |
from poodr.rb:5:in `each' | |
from poodr.rb:5:in `prepare' | |
from poodr.rb:54:in `<main>' |
This is the latest version of an email which I send periodically, offering customers the opportunity to pre-pay for SaaS in return for a discount. The benefits to the SaaS company are better cash flow and reduced churn rate. The benefits to the customer are, well, in the email. This genre of email has produced hundreds of thousands of dollars in pre-pays for some companies I work with, and it rarely requires any more work than this example.
I've put $79 is as a placeholder for the cost of the user's plan. We calculate that for each account, naturally, along with the billing contact's name.
Subject: Save $79 on Appointment Reminder (and get a tax write-off) Formatting: 100% plain text. Gmail automatically links up the central link. From: Patrick McKenzie (Appointment Reminder) [email protected]