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
# Ask Nokogiri to find the row containing the header names | |
headers = table.search('thead > tr') | |
# Create a hash that maps the column name to the column index, so I can access subsequent | |
# rows' data by name | |
header_map = headers.search('th') | |
.map(&:text) | |
.each_with_index | |
.with_object({}) {|(name, index), hash| hash[name] = index} |
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 m(*args) | |
print "Args to m: ", args.inspect, " Result: " | |
120 | |
end | |
n = 6 | |
o = 2 | |
# Imagine using a language where whitespace is significant? Pah! | |
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
<?xml version="1.0" encoding="utf-8"?> | |
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:rx="http://www.renderx.com/XSL/Extensions"> | |
<!-- ============================================================ --> | |
<!-- --> | |
<!-- This file makes a part of RenderX XSL Test Suite --> | |
<!-- --> | |
<!-- Author: Alexander Peshkov --> | |
<!-- --> | |
<!-- (c) RenderX, 2003 --> | |
<!-- --> |
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 MigrationHelpers | |
def fk(from_table, from_column, to_table=from_column.to_s.sub(/_id$/, 's')) | |
constraint_name = "fk_#{from_table}_#{from_column}" | |
execute %{alter table #{from_table} | |
add constraint #{constraint_name} | |
foreign key (#{from_column}) | |
references #{to_table}(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
if RUBY_PLATFORM =~ /java/ | |
ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil | |
require 'rubygems' | |
gem 'nokogiri' | |
end | |
require 'nokogiri' | |
doc = Nokogiri::XML.parse(DATA.read, nil, 'utf-8') | |
p doc.errors |
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 File.expand_path(File.dirname(__FILE__) + '/../test_helper') | |
class BuildStatusTest < ActiveSupport::TestCase | |
context "expiring build statii" do | |
should "remove the old one" do | |
assert_equal 2, BuildStatus.count | |
BuildStatus.expire_old | |
statii = BuildStatus.all | |
assert_equal 1, statii.size | |
assert statii[0].updated_at >= 30.days.ago |
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
dave[~/Play 7:58:42] gem update rails | |
Updating installed gems | |
Updating coffee-rails | |
Fetching: activesupport-3.2.0.rc2.gem (100%) | |
Fetching: activemodel-3.2.0.rc2.gem (100%) | |
Fetching: rack-1.4.0.gem (100%) | |
Fetching: journey-1.0.0.rc4.gem (100%) | |
Fetching: sprockets-2.1.2.gem (100%) | |
Fetching: actionpack-3.2.0.rc2.gem (100%) | |
ERROR: Error installing coffee-rails: |
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 MigrationHelpers | |
def fk(from_table, from_column, to_table=from_column.to_s.sub(/_id$/, 's')) | |
constraint_name = "fk_#{from_table}_#{from_column}" | |
execute %{alter table #{from_table} | |
add constraint #{constraint_name} | |
foreign key (#{from_column}) | |
references #{to_table}(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
def test | |
"just to see" | |
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
module SystemHook | |
private | |
def system(*args) | |
super.tap do |result| | |
puts "system(#{args.join(', ')}) returned #{result.inspect}" | |
end | |
end | |
end | |
class Object |