View f3-inline-checksum.xml
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora Object-to-Object Relationship Metadata" CREATED="2014-01-27T19:33:31.713Z" MIMETYPE="application/rdf+xml" SIZE="411">
<foxml:contentDigest TYPE="SHA-256" DIGEST="dc9dd47194e9e6796ca727b232d1b597afde15c430b0777c2a4e1defa5f4f3ea"/>
<foxml:xmlContent>
<rdf:RDF xmlns:ns0="http://projecthydra.org/ns/relations#" xmlns:ns1="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/duke:1556">
<ns0:isGovernedBy rdf:resource="info:fedora/duke:1555"/>
<ns1:hasModel rdf:resource="info:fedora/afmodel:Collection"/>
</rdf:Description>
</rdf:RDF>
View gist:f507277bd4e1017fd9af
scope :in_collection, ->(collection) {
where(Ddr::Index::Fields::IS_MEMBER_OF_COLLECTION => collection.respond_to?(:id) ? collection.id : collection)
}
scope :having_local_id, ->(local_id) {
where(Ddr::Index::Fields::LOCAL_ID => local_id)
}
def self.having_local_id!(local_id)
results = having_local_id(local_id).to_a
if results.size > 1
View virtus_model.rb
require "virtus"
# BEFORE
class Filter
attr_accessor :clauses
def initialize(clauses = nil)
@clauses = Array(clauses)
end
end
View autoversion.rb
module ActiveFedora
module Autoversion
def self.included(base)
base.class_eval do
after_save :create_version
end
end
end
end
View ostruct_delegator.rb
require "ostruct"
require "delegate"
class OpenStructDelegator < SimpleDelegator
def initialize(args)
super OpenStruct.new(args)
end
View fits_servlet.rb
require 'net/http'
FITS_SERVLET = "http://127.0.0.1:8080/FITSservlet/FitsServlet_2"
uri = URI(FITS_SERVLET)
# replace value with path to file
uri.query = URI.encode_www_form(file: "/tmp/logo.png")
response = Net::HTTP.get_response(uri)
View unconcerned.rb
ActiveSupport::Concern.module_eval do
WARNINGS = [
"Are you sure you want to this?",
"Come on, now, really?",
"Time to refactor?",
"Read http://blog.coreyhaines.com/2012/12/why-i-dont-use-activesupportconcern.html ?",
"Please don't do this without a good reason.",
"No, chunking your mega-class is not a good reason.",
"What objects are you trying to hide?",
View ability.rb
class Ability
include CanCan::Ability
class_attribute :permissions
attr_reader :user
def initialize(user)
@user = user
apply_permissions
View delws.sh
#!/bin/sh
TYPES="*.rb *.css *.js *.rake"
git ls-files ${TYPES} | xargs sed -E -i "" "s/[[:space:]]+$//g"
View duketerms.rdf.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
<!ENTITY rdfns 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<!ENTITY rdfsns 'http://www.w3.org/2000/01/rdf-schema#'>
<!ENTITY dcns 'http://purl.org/dc/elements/1.1/'>
<!ENTITY dctermsns 'http://purl.org/dc/terms/'>
<!ENTITY dctypens 'http://purl.org/dc/dcmitype/'>
<!ENTITY dcamns 'http://purl.org/dc/dcam/'>
<!ENTITY skosns 'http://www.w3.org/2004/02/skos/core#'>
]>