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 'yaml' | |
data = YAML.load(STDIN.read) | |
kind = data['kind'] | |
# status | |
if kind == 'Route' |
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
<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> |
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
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 |
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 "virtus" | |
# BEFORE | |
class Filter | |
attr_accessor :clauses | |
def initialize(clauses = nil) | |
@clauses = Array(clauses) | |
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
module ActiveFedora | |
module Autoversion | |
def self.included(base) | |
base.class_eval do | |
after_save :create_version | |
end | |
end | |
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
require "ostruct" | |
require "delegate" | |
class OpenStructDelegator < SimpleDelegator | |
def initialize(args) | |
super OpenStruct.new(args) | |
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
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) |
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
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?", |
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
class Ability | |
include CanCan::Ability | |
class_attribute :permissions | |
attr_reader :user | |
def initialize(user) | |
@user = user | |
apply_permissions |
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/sh | |
TYPES="*.rb *.css *.js *.rake" | |
git ls-files ${TYPES} | xargs sed -E -i "" "s/[[:space:]]+$//g" |
NewerOlder