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
resources(:runs, :member => { :random => :get }, :identify => :escaped_name) do |run| | |
authenticate do | |
run.match('/pages/:page').to(:controller => :run_pages, :action => 'show').name(:page) | |
run.match('/pages/:page/save', :method => :post).to(:controller => :run_pages, :action => :save).name(:page_save) | |
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
# From http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/256730 | |
module Endian | |
def self.big? | |
endianness == :big | |
end | |
def self.little? | |
endianness == :little | |
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
1) Failure: | |
test_bad_document_calls_error_handler(Nokogiri::XML::SAX::TestParser) [./test/xm | |
l/sax/test_parser.rb:13]: | |
<nil> is not true. | |
2) Failure: | |
test_errors_set_after_parsing_bad_dom(Nokogiri::XML::SAX::TestParser) [./test/xm | |
l/sax/test_parser.rb:22]: | |
<nil> is not true. |
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/bin/g++-4.2 -DHAVE_CONFIG_H -I../.. -I../.. -I/opt/local/include -Wall -Wextra -pedantic -Wundef -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wredundant-decls -Wno-long-long -Wstrict-aliasing -Wshadow -O3 -ggdb3 -std=gnu++98 -Wno-effc++ -MT binary_log.pb.lo -MD -MP -MF .deps/binary_log.pb.Tpo -c binary_log.pb.cc -fno-common -DPIC -o .libs/binary_log.pb.o | |
In file included from /opt/local/include/google/protobuf/unknown_field_set.h:44, | |
from /opt/local/include/google/protobuf/generated_message_reflection.h:44, | |
from binary_log.pb.h:21, | |
from binary_log.pb.cc:3: | |
/opt/local/include/google/protobuf/repeated_field.h: In constructor ‘google::protobuf::RepeatedPtrField<Element>::RepeatedPtrField(const google::protobuf::Message*) [with Element = google::protobuf::Message]’: | |
/opt/local/include/google/protobuf/repeated_field.h:481: warning: declaration of ‘prototype’ shadows a member of 'this' | |
/opt/local/include/google/protobuf/repeated_field. |
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
# Requirements: Pass the unit tests at the bottom (in a non-trivial | |
# way) and be cleanly translatable to Java. That means no block and | |
# yield magic allowed nor setting values in the condition statements | |
# of loops. | |
require 'test/unit' | |
class UserBuffer | |
def initialize(arr) | |
@file = arr |
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 ClassMethods | |
def blamed | |
- belongs_to :creator, :class_name => 'Person' | |
- belongs_to :updater, :class_name => 'Person' | |
+ class_eval do | |
+ attr_accessor :current_updater | |
+ | |
+ belongs_to :creator, :class_name => 'Person' | |
+ belongs_to :updater, :class_name => 'Person' | |
+ validates_presence_of :creator |
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 'dryopteris' | |
require 'test/unit' | |
class TestFeedparser < Test::Unit::TestCase | |
def test_frameset | |
# This fails by returning "safe<b>description</b>". | |
assert_equal "safe <b>description</b>", | |
Dryopteris.whitewash("safe<frameset rows=\"*\"><frame src=\"http://example.com\"></frameset> <b>description</b>") | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'net/http' | |
require 'json' | |
DEFAULT_HOST = 'http://127.0.0.1:7000' | |
def read_from_stdin | |
while url = 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
implicit def clipMinArrayWrapper[A <% Ordered[A]](x: Array[A]) = new { | |
private def smaller[B <% Ordered[B]](p: B, q: B) : B = { | |
if (p < q) return(p) else return(q) | |
} | |
def min() : A = { | |
min((p) => p) | |
} | |
def min[B <% Ordered[B]](f: A => B) : B = { |
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
<div style="margin-bottom: 5px; padding-left: 3em; text-indent: -3em;"> | |
<i> | |
Services: <b>Grooming </b> </i> | |
</div> | |
<div>6211 Dutton Rd, | |
Mendon, | |
OH <span id="zipVal0" style="display:none;">45862</span><span ID="zipLabel0"> <a style="font-size:11px;" href="javascript:showZip('0');">zip code</a></span></div> | |
</div><!-- div addr 2 //--> | |
<div style="white-space:nowrap" > |