Skip to content

Instantly share code, notes, and snippets.

Avatar
🌐
building itsy bitsy parts of the internet

Ryan McGeary rmm5t

🌐
building itsy bitsy parts of the internet
View GitHub Profile
@burke
burke / 0-readme.md
Created Jan 27, 2012 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv
View 0-readme.md

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@brettkelly
brettkelly / makeAmazonAffUrl.py
Created Jul 15, 2012
Python to rework Amazon URL to contain the user's affiliate code
View makeAmazonAffUrl.py
#!/usr/bin/env python
# (c) 2012 Brett Kelly.
# Licensed under the MIT license
# http://www.opensource.org/licenses/mit-license.php
import re
import sys
from urlparse import urlparse
@rmm5t
rmm5t / benchmark_style_multiple_comparison.rb
Last active Jun 18, 2019
Style/MultipleComparison benchmark
View benchmark_style_multiple_comparison.rb
require 'benchmark'
def test_conditionals(n)
n == 1 || n == 2 || n == 3 || n == 4 || n == 5 || n == 6 || n == 7
end
def test_include(n)
[1, 2, 3, 4, 5, 6, 7].include?(n)
end
@rmm5t
rmm5t / benchmark_tag_vs_interpolation.rb
Last active Jun 18, 2019
Benchmarking tag vs content_tag vs string interpolation
View benchmark_tag_vs_interpolation.rb
require 'benchmark'
require 'action_view'
include ActionView::Helpers::TagHelper
include ERB::Util
def output_buffer=(s)
end
def output_buffer
end
@rmm5t
rmm5t / benchmark_instance_var_vs_delegate.rb
Last active Jun 18, 2019
Benchmark instance variable vs delegation
View benchmark_instance_var_vs_delegate.rb
require 'benchmark'
require 'active_support/all'
Source = Struct.new(:value, keyword_init: true)
class InstanceVarTest
attr_reader :source, :value
def initialize(source)
@source = source
@rmm5t
rmm5t / benchmark_local_var_vs_instance_var.rb
Last active Jun 18, 2019
Benchmark local var caching vs direct method access
View benchmark_local_var_vs_instance_var.rb
require 'benchmark'
require 'active_support/all'
Source = Struct.new(:value, keyword_init: true)
def local_var_test(source)
value = source.value
return if value.nil?
value
end
@rmm5t
rmm5t / benchmark_command_object_vs_poro.rb
Last active Jun 18, 2019
Benchmarking command object pattern vs PORO
View benchmark_command_object_vs_poro.rb
require 'benchmark'
require 'active_support/all'
class CommandObject
def self.execute_with(arg)
new(arg).tap(&:run)
end
def initialize(arg)
@arg = arg