Skip to content

Instantly share code, notes, and snippets.

@armadsen
armadsen / LabelDimensions.csv
Created March 4, 2013 18:49
CSV file containing dimensions information for various Avery label sheets.
labelTypeName labelSheetWidth labelSheetHeight topMargin bottomMargin leftMargin rightMargin numberOfRows numberOfColumns horizontalGutter verticalGutter
Avery 2160 Bottom 8.5 11 5.5 0.5 0.81 0.81 4 1 0 0
Avery 2160 Top 8.5 11 0.5 5.5 0.81 0.81 4 1 0 0
Avery 2162 Bottom 8.5 11 5.5 0.5 0.125 0.125 3 1 0 0
Avery 2162 Top 8.5 11 0.5 5.5 0.125 0.125 3 1 0 0
Avery 2163 Bottom 8.5 11 5.5 0.5 0.125 0.125 2 1 0 0
Avery 2163 Top 8.5 11 0.5 5.5 0.125 0.125 2 1 0 0
Avery 2164 Bottom 8.5 11 5.844 0.844 0.125 0.125 1 1 0 0
Avery 2164 Top 8.5 11 0.844 5.844 0.125 0.125 1 1 0 0
Avery 5159 8.5 11 0.25 0.25 0.156 0.156 7 2 0.188 0
require 'benchmark/ips'
require 'redis'
class MethodProfiler
def self.patch(klass, methods, name)
patches = methods.map do |method_name|
<<~RUBY
unless defined?(#{method_name}__mp_unpatched)
alias_method :#{method_name}__mp_unpatched, :#{method_name}
def #{method_name}(*args, &blk)
unless prof = Thread.current[:_method_profiler]