View marc21_changed_code.rb
def extract_marc(spec, options = {})
# ... stuff deleted for clarity
## CREATE THE CHAIN
ppchain = Marc21.create_post_processing_chain(options, translation_map)
lambda do |record, accumulator, context|
accumulator.concat extractor.extract(record)
View Talk About Fedora.adoc

Samvera#General talking about Fedora

Tuesday, August 29, 2017

Mike Giarlo (5:56 PM)

Have folks here been hearing all manner of rumors today about Samvera, or certain Samvera institutions, walking away from Fedora and other community components? Some of us are hearing these rumors as of a few hours ago, and we’re trying to figure out where the misinformation is coming from.

It seems to center on Valkyrie. We did discuss Valkyrie and Fedora futures on today’s Fedora Leadership group, but not in the context the rumors are in.

View safer_reindex_everything.rb
require 'active-fedora'
require 'json'
def descendant_uris(uri)
begin
resource = Ldp::Resource::RdfSource.new(ActiveFedora.fedora.connection, uri)
rescue
STDERR.puts "Failed to create resource for uri #{uri}"
return []
end
View solread_patch_benchmark.rb
require 'benchmark'
require 'uri'
require 'solr_ead'
require 'concurrent'
# Make a subclass with all the speed patches
class IndexerWithPatches < SolrEad::Indexer
def additional_component_fields(node, addl_fields = Hash.new)
# Clear or create the cache
View arclight_monkeypatch.rb
require "URI"
require 'solr_ead'
class SolrEad::Indexer
def additional_component_fields(node, addl_fields = Hash.new)
p_ids = parent_id_list(node)
p_unittitles = parent_unittitle_list(node)
View ALTERNATE_TEMPLATE_INSTALL.md

Install using a template:

This is slighly different in that it installs the gems inside the app directory in yourappname/.bundle and uses native libxml2 to compile nokogiri.

$ ruby -v # need a 2.3 or later
   => 2.4.0
$ rails -v # 
   => 5.0.2
View hyrax_install.md

Install a skeleton Rails app with Hyrax

(from Seth Johnson)

$ ruby -v
    => ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linu

$ rails -v
    => Rails 5.0.2
View build_an_iterator_1.rb
# A simpler example: create an object which takes
# in a file name and allows you to iterate over
# only the comments (lines that start with '#')
#
# Obviously, it'd be pretty easy to do this inline, but it's just an
# example. One could also imagine it returning every set of
# contiguous comment lines as a single comment, or even being smart enough to
# do C-style /* ... */ comments and extract those.
#
# The point is that you've got that all hidden in a class, and the user
View taghosts
#!/usr/bin/env ruby
require 'optparse'
ACTIVE_SERVERS = '/l/local/active-servers'
def alltags
alltags = []
File.open(ACTIVE_SERVERS).each do |line|
tokens = line.split(/\s+/)
View marc_html.rb
# encoding: UTF-8
require 'slim'
require 'marc'
# Get a record somehow. Here, I just nab the marc-in-json from the HT catalog and use that.
require 'json'
require 'open-uri'
rec = MARC::Record.new_from_hash(JSON.parse(open('http://catalog.hathitrust.org/Record/100113248.json').read))