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 Kernel | |
alias_method :debug_original_require, :require | |
@@load_order_logger = nil | |
@@load_order_indent = '' | |
def self.load_order_logger | |
@@load_order_logger | |
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
196 @sing | |
181 @ana | |
93 @quote | |
91 @karma | |
72 @who | |
43 @decide | |
32 @band | |
29 @dunno | |
27 @rate | |
27 @love |
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 'nokogiri' | |
module Nokogiri | |
module XML | |
# Attribute nodes are semantically equal if their names and values match exactly | |
class Attribute | |
def compare_semantics(node, opts) |
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
xmlr = XmlRegistry.new | |
xmlr.template(:person) do |xml,name,title| | |
xml.person :title => title, name | |
end | |
doc = Nokogiri::XML('<people/>') | |
doc.root.add_child(xmlr.person('Jeff Lebowski','The Dude')) | |
doc.to_xml | |
=> "<people><person title=\"The Dude\">Jeff Lebowski</person></people>" |
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
#!/bin/bash | |
framework=$1 | |
project=$2 | |
remote=$3 | |
if [[ ! ("$#" -eq 3)]] | |
then | |
echo >&2 "Usage: $0 <framework-repo> <project-name> <project-repo>" | |
exit 1 |
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
alias grep='grep --color=auto' | |
alias egrep='egrep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias ls='ls -G' |
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"?> | |
<object PID="druid:bm891ts1074"> | |
<objectType>item</objectType> | |
<tag>MDForm : ms</tag> | |
<tag>Project : Manuscripts</tag> | |
<otherId name="uuid">39ec8596-30b8-5b26-231e-41583ae3d3bf</otherId> | |
<objectId>druid:bm891ts1074</objectId> | |
<objectCreator>DOR</objectCreator> | |
<descMetadata> | |
<title>Manuscript Title</title> |
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
<add> | |
<doc> | |
<field name="id">druid:bm891ts1074</field> | |
<field name="title">Manuscript Title</field> | |
<field name="workflow">accessionWF</field> | |
<field name="workflow">digitizationWF</field> | |
<field name="status">completed</field> | |
<field name="status">waiting</field> | |
<field name="status">error</field> | |
<field name="status_wps">accessionWF:start-accession:completed</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
BYTE_ORDERS = ['B','KB','MB','GB','TB','PB','EB'] | |
class Numeric | |
def bytestring | |
order = 0 | |
while (self > 1024 ** (order+1)) | |
order += 1 | |
end | |
"%.1f %s" % [self.to_f / (1024 ** order), BYTE_ORDERS[order]] | |
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
c = Confstruct::Configuration.new(:foo => {}) | |
c.configure do |c1| | |
# the block expects one param, so we've remained bound to | |
# the outer scope and yielded c. | |
# IOW, self == whatever self was outside the block, and c1 == c. | |
c1.x 123 # calls c1.method_missing(:x, 123) | |
c1.y = 456 # calls c1.method_missing(:y=, 123) | |
c1.foo.bar = 789 # calls ca.foo.method_missing(:bar=, 789) | |
end |