Skip to content

Instantly share code, notes, and snippets.

@maxenglander
maxenglander / tidy_helper.rb
Created December 6, 2011 15:44
Tidy XML with Ruby
module TidyHelper
def self.tidy_xml xml_string
IO.popen("tidy -q --input-xml y --output-xml y --indent 'auto' --indent-attributes y --indent-spaces '4' --wrap '90'", "w+") do |pipe|
buffer = String.new
@maxenglander
maxenglander / nested_before_all_example.rb
Created December 6, 2011 20:10
RSpec2 example with nested before(:all) blocks
require "spec_helper"
describe "An RSpec example using nested before(:all) blocks" do
before(:all) do
puts "This is called at the beginning of the example"
end
it "Tests something" do
false.should eq(false)
end
@maxenglander
maxenglander / .vimrc
Created December 22, 2011 19:25
Jordan is a smelly bum
set autoindent
set autoread
set backspace=eol,start,indent
set expandtab
set history=700
set nobackup
set nowb
set noswapfile
set ruler
set smartindent
@maxenglander
maxenglander / total_price_comparison.rb
Created March 7, 2012 15:54
TotalPriceComparison
class TotalPriceGreaterThan
def display
"Customer spent more than #{threshold}"
end
def evaluate
receipt().total_price() > threshold()
end
def purchase
@maxenglander
maxenglander / equals.rb
Created March 7, 2012 16:17
TotalPriceComparison
class GreaterThan
def display
"more than"
end
def evaluate one, two
one > two
end
end
@maxenglander
maxenglander / Cohort report
Created June 28, 2012 22:10
Proposed product report schemas
{
client_id: $client_id,
cohort_type: $cohort_type, // Sign up date, first purchase date
cohort_bin_width: $cohort_bin_width, // Week, month, quarter, year
cohort_value: $cohort_value, // 20120407, 201204, 2012.1, 2012
// Further segmentation?
// engagement
// location

Test

Test 2

hello world!

@maxenglander
maxenglander / fiddle.response.json
Created July 26, 2012 07:49
Gist responses for Annotator
[]
@maxenglander
maxenglander / fiddle.css
Created July 26, 2012 10:11
Annotator example
.my_highlight {
text-decoration:underline;
background-color:orange;
}