Skip to content

Instantly share code, notes, and snippets.

View ctm's full-sized avatar

Clifford T. Matthews ctm

View GitHub Profile
# This is just a portion of the (November 17th, 2007) file ...
def filtered_body(comment)
body = comment.body
if comment.posted_by =~ /href="mailto:jerseymcjones@gmail.com"/
parser = HTMLTree::XMLParser.new(false,false)
parser.feed("<html>#{body}</html>")
xml = parser.document
encheferize(xml.root)
body = ''
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
#! /usr/bin/env ruby
require 'rspec'
require 'forwardable'
# This is a cleaner implementation of Forwardable. It does not use string evaluation,
# nor does it have any rescues in it. This code grew out of a discussion at RubiABQ
# http://www.meetup.com/Rubyists-in-Albuquerque/events/225108828/
module MyForwardable
@ctm
ctm / wser_odds.rb
Created December 1, 2012 22:43
A Ruby program to compute the odds of winning an entry into the Western States Endurance Run
#! /usr/bin/env ruby
require 'set'
COUNTS = [ 1490, 482, 207, 122].freeze # 1490 have 1 ticket, 482 have 2, etc.
N_DRAWS = 275
USER_MAP = {}
#! /usr/bin/env ruby
# $VERBOSE = true
require 'rubygems'
require 'ri_cal'
require 'tzinfo'
# We're in Albuquerque, so we make Mountain time our time zone