Skip to content

Instantly share code, notes, and snippets.

@gunn
gunn / directory_web_service.rb
Created January 29, 2011 10:44 — forked from anonymous/directory_web_service.rb
Refactor of some code from a blog post.
require 'mechanize'
require 'nokogiri'
require 'sinatra'
get '/:psuid' do
find_name params[:psuid]
end
def find_name(psuid)
@gunn
gunn / singleton_methods.rb
Created January 15, 2011 09:34 — forked from samnang/singleton_methods.rb
A large executable list of methods of define singleton methods in ruby
##############################################
# Different ways to define singleton methods #
##############################################
# Being able to reference external instance variables when creating a method
# enables useful meta-programming techniques in ruby. The styles which are
# capable of this will define methods that "Moof!" (like Clarus the Dogcow).
moof = "Moof!"
@gunn
gunn / routes.rb
Created January 14, 2011 09:30 — forked from anonymous/gist:779401
Help for an IRC user
Blog::Application.routes.draw do
resources :posts do
resources :comments
end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => "home#index"
end
task :test do
["git clone git://github.com/radiant/radiant-reorder-extension.git vendor/extensions/reorder",
"rake radiant:extensions:reorder:migrate",
"rake radiant:extensions:reorder:update"].each do |command|
begin
sh( command )
rescue Exception => e
puts e
puts "FAIl!"
exit