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 Ancestor | |
attr_accessor :id | |
def initialize(id) | |
@id = id | |
end | |
def ==(other) | |
id == other.id | |
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
A->B: | |
B->C: |
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 ActiveRecord | |
class Base | |
alias_method :original_to_json, :to_json | |
end | |
end | |
require "json/add/rails" | |
module ActiveRecord | |
class Base |
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 image_tag(source, options = {}) | |
if options.is_a?(Hash) && source !~ /^http/ | |
size = `identify public/images/#{source}`[/ (\d+x\d+) /, 1] | |
if options[:size] | |
if options[:size] != size | |
line = "*** WRONG SIZE SPECIFIED FOR #{source}: :size => #{size.inspect} ***" | |
end | |
else |
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
get '/posts/:id' do | |
# Render with or without a layout depending | |
# on request#xhr?. Useful for rendering regular | |
# requests and also partial updates like: | |
# $("#post").load('/posts/1') | |
haml :'posts/show', :layout => !request.xhr? | |
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
# DISCLAIMER: this is just a hack, not even tested. | |
# I use this for testing interaction with Facebook. | |
# Basically there are a bunch of fixture XMLs that | |
# represent the response from Facebook. | |
# Oh, make sure you do this somewhere, probably in | |
# a setup/before block: | |
# | |
# Facebooker::Session.current = Facebooker::MockSession.create | |
# | |
# (You might need to stub session[:facebook_session] too.) |
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 TagsHelperTest < Test::Unit::TestCase | |
# helper 'app/helpers/tags' | |
# | |
# def test_tag | |
# assert_equal "<div></div>", helper.tag(:div) | |
# end | |
# end | |
require 'haml/engine' | |
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
#!/usr/local/bin/ruby | |
# Usage: | |
# | |
# $ build.rb http://yoururl.com/your_project/push | |
# | |
# $ echo "HEAD -1 refs/heads/master" | build.rb http://yoururl.com/your_project/push | |
# | |
# or you can hard-code the URL in the following line instead | |
# of passing it as an argument. |
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 'rubygems' | |
dependencies = <<-EOS | |
rack 0.9.1 | |
activesupport >= 2.2.2 | |
daemons >= 1.0.10 | |
djanowski-workling | |
djanowski-collage >= 0.1.3 | |
faker >= 0.3.1 | |
fiveruns-memcache-client >= 1.5.0 |
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 "test/unit" | |
class FooTest < Test::Unit::TestCase | |
def setup | |
@value = true | |
end | |
def test_truth | |
assert @value | |
end |
OlderNewer