Skip to content

Instantly share code, notes, and snippets.

View rmm5t's full-sized avatar
🌐
building itsy bitsy parts of the internet that grow

Ryan McGeary rmm5t

🌐
building itsy bitsy parts of the internet that grow
View GitHub Profile
puts "Holy crap, Batman, this is freakin' wicked!"
@rmm5t
rmm5t / Gemfile
Created September 23, 2014 15:33
font-awesome-rails issues #113 support
source 'https://rubygems.org'
ruby '2.1.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.6'
gem 'sqlite3'
## Assets
gem "sprockets-rails", "~> 2.1.3"
# Use SCSS for stylesheets
# Courtesy @zenspider
# http://exercism.io/submissions/b0613bbac84cd95fcad40e6b
class Hamming0
def self.compute s1, s2
length = [s1.length, s2.length].min
length.times.count { |i| s1[i] != s2[i] }
end
end
@rmm5t
rmm5t / keybase.md
Created June 3, 2015 16:42
keybase.md

Keybase proof

I hereby claim:

  • I am rmm5t on github.
  • I am rmm5t (https://keybase.io/rmm5t) on keybase.
  • I have a public key whose fingerprint is 79DA 34B8 A2E7 3C96 E0CC 5BB2 005A C77D 7CBF 3EAF

To claim this, I am signing this object:

@rmm5t
rmm5t / vcard2asterisk
Created December 5, 2008 20:56
vCards -> Asterisk commands for improved caller id
#!/usr/bin/env ruby
# Example Usage:
# vcard2asterisk *.vcf
# vcard2asterisk http://getvcard.com/dogetvcard.asp?UID=LD7U7mM
require 'rubygems'
require 'vpim/vcard'
def format_phone_number(phone)
@rmm5t
rmm5t / gist:41978
Created December 31, 2008 14:50 — forked from jimweirich/gist:41973
;;; Load twittering mode.
(require 'twittering-mode)
(load "~/.pw/twittering-pw.el" 'noerror)
@rmm5t
rmm5t / controller_macros.rb
Created January 12, 2009 23:22
Less verbose controller macros for shoulda.
# Helper controller macros that define:
# on_get, on_post, on_put, on_delete
module ControllerMacros
[:get, :post, :put, :delete].each do |method|
class_eval <<-RUBY
def on_#{method}(action, options = {}, &block)
on_http_method(#{method.inspect}, action, options, &block)
end
RUBY
module ControllerMacros
[:get, :post, :put, :delete].each do |method|
class_eval <<-RUBY
def on_#{method}(action, options = {}, &block)
on_http_method(#{method.inspect}, action, options, &block)
end
RUBY
end
def on_http_method(method, action, options = {}, &block)
#!/usr/bin/env ruby
Package = Struct.new(:name, :path, :main, :globs)
packages =
[
Package.new("ruby", "~/external/ruby-1.8.7-p72", "README", %w(*.c lib/**/*.rb)),
Package.new("rails", "~/external/rails", "railties/README", %w(*/README */lib/**/*)),
Package.new("shoulda", "~/external/shoulda", "README.rdoc", %w(lib/**/*.rb))
]
class Test::Unit::TestCase
# Ensures that the model has a method named scope_name that returns a NamedScope object with the
# proxy options set to the options you supply. scope_name can be either a symbol, or a method
# call which will be evaled against the model. The eval'd method call has access to all the same
# instance variables that a should statement would.
#
# Options: Any of the options that the named scope would pass on to find.
#
# Example:
#