This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "dependency_loader" | |
class BiosController < ApplicationController | |
extend DependencyLoader(:person) | |
def new | |
@bio = @person.bios.build | |
end | |
# ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INITIAL SCOPE OF WORK FOR RESOURCE DATA, INC January 27 2011 | |
RDI SCOPE OF WORK – WORKING TOGETHER & PHASE 1 OF MARKETING ARCHIVE | |
WORKING TOGETHER - 8 hours | |
1. Cover the following topics and decide upon standards | |
a. Git | |
- workflow | |
b. Testing frameworks | |
c. Rails template | |
- a skeleton app template, to be reused on the other apps? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DerpController < VariableController | |
controller_variable :derp_con | |
command :con, :protected => true do | |
if message.text.empty? | |
reply derp_con | |
else | |
self.derp_con = message.text | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gem update --system | |
Updating rubygems-update | |
Successfully installed rubygems-update-1.7.0 | |
Installing RubyGems 1.7.0 | |
<internal:lib/rubygems/custom_require>:32:in `rescue in require': undefined method `try_activate' for Gem:Module (NoMethodError) | |
from <internal:lib/rubygems/custom_require>:29:in `require' | |
from d:/Ruby192/lib/ruby/gems/1.9.1/gems/rubygems-update-1.7.0/lib/rubygems.rb:31:in `<top (required)>' | |
from <internal:lib/rubygems/custom_require>:29:in `require' | |
from <internal:lib/rubygems/custom_require>:29:in `require' | |
from setup.rb:24:in `<main>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Derp < Rubot::WebResource | |
get :chuck, 'http://4q.cc/index.php?pid=fact&person=chuck' do |doc| | |
if fact = doc.css("#factbox").first | |
fact.text.strip | |
else | |
"fail" | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
server = TCPServer.new('localhost', 6500) | |
loop do | |
request = server.accept | |
next unless ready = select([server]) | |
puts server.gets # perhaps request.gets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
# Generates a content_for helper using the given symbol as | |
# the method name. | |
# | |
# Example: this code generates a method called 'head' that | |
# will be available in all views. | |
# content_for_helper :head | |
def self.content_for_helper(sym) | |
define_method sym do |content| | |
content_for sym, content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_method(obj, method) | |
obj.class.ancestors.each do |a| | |
return a if a.public_instance_methods(false).map(&:to_s).include?(method.to_s) | |
end | |
nil | |
end |
NewerOlder