Skip to content

Instantly share code, notes, and snippets.

@latortuga
latortuga / delete_failed_jobs.rb
Created September 15, 2022 18:37 — forked from nisanthchunduru/delete_failed_jobs.rb
Selectively remove/retry failed jobs in Resque 1.x
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

Notes

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) patrick@appointmentreminder.org

has_many :child_connections, :class_name => 'Connection', :foreign_key => 'from_id'
has_many :parent_connections, :class_name => 'Connection', :foreign_key => 'to_id', :dependent => :destroy
has_many :children, :through => :child_connections, :source => :to
has_many :parents, :through => :parent_connections, :source => :from
@latortuga
latortuga / about.md
Created August 9, 2011 15:47 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
#!/usr/bin/env python
"""
fabfile.py
Copyright (c) 2011 Giovanni Collazo
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
@latortuga
latortuga / webapp.rb
Created November 16, 2010 19:49 — forked from igrigorik/webapp.rb
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@latortuga
latortuga / refresh_css.js
Created October 27, 2010 19:26 — forked from mikelikespie/refresh_css.js
CSS reload bookmarklet
/*
Add a bookmark to this
javascript:(function(){var c=document.getElementsByTagName("link");for(var d=0;d<c.length;d++){var a=c[d];if(a.type=="text/css"){var e="css_buster_"+Math.floor(Math.random()*1000000000);var g=a.href.split("?",1);var f;if(g.length>1){var b=g[1].indexOf("&")==-1;if(b){f=e}else{f=g[1]+"&"+e}}else{f=e}a.href=g[0]+"?"+f}}})();
*/
(function() {
var links = document.getElementsByTagName('link');
for (var i = 0; i < links.length; i++) {
var l = links[i];
if (l.type == 'text/css') {