Skip to content

Instantly share code, notes, and snippets.

View mcritchlow's full-sized avatar

Matthew Critchlow mcritchlow

  • UC San Diego
  • San Diego
View GitHub Profile
@mcritchlow
mcritchlow / Gemfile
Last active August 29, 2015 13:57 — forked from escowles/Gemfile
source 'https://rubygems.org'
gem 'active-fedora', github: 'projecthydra/active_fedora', branch: 'master'
gem 'linkeddata'
@mcritchlow
mcritchlow / facet_test.rb
Last active August 29, 2015 14:06
Facet Checked
class Facet
def checked_one_liner?(field,value,params)
params['f'] && params['f'][field] && params['f'][field].include?(value)
end
def checked?(field,value,params)
params.has_key?('f') && params['f'].has_key?(field) && params['f'][field].include?(value)
end
end
@mcritchlow
mcritchlow / embargo_examples.xml
Last active August 29, 2015 14:07
Embargo Examples created by @escowles for DAMS4 Data Model v1
<!-- Currently under embargo -->
<dams:Object rdf:about="http://library.ucsd.edu/ark:/20775/xx00000012">
<dams:title>
<mads:Title>
<mads:authoritativeLabel>#12: Curator: Third Party Copyright, License Override (Embargoed)</mads:authoritativeLabel>
<mads:elementList rdf:parseType="Collection">
<mads:MainTitleElement>
<mads:elementValue>#12: Curator: Third Party Copyright, License Override (Embargoed)</mads:elementValue>
</mads:MainTitleElement>
</mads:elementList>
@mcritchlow
mcritchlow / output
Created October 8, 2014 16:47
ArchivesHub AccessRestrictions Sample Usage
<http://data.archiveshub.ac.uk/id/archivalresource/gb1832-crck/crck2/3/34> <http://data.archiveshub.ac.uk/def/accessRestrictions> "Closed until 2061 in accordance with Data Protection laws. "@EN .
<http://data.archiveshub.ac.uk/id/archivalresource/gb162-mss.brit.emp.s.547> <http://data.archiveshub.ac.uk/def/accessRestrictions> "Bodleian reader's ticket required."@EN .
<http://data.archiveshub.ac.uk/id/archivalresource/gb29-eulms231> <http://data.archiveshub.ac.uk/def/accessRestrictions> "Usual EUL arrangements apply."@EN .
<http://data.archiveshub.ac.uk/id/archivalresource/gb271-gcpppower-b> <http://data.archiveshub.ac.uk/def/accessRestrictions> " Access is open to bona fide scholars by appointment only. "@EN .
<http://data.archiveshub.ac.uk/id/archivalresource/gb271-gcppturle> <http://data.archiveshub.ac.uk/def/accessRestrictions> " Access is open to bona fide scholars by appointment only. "@EN .
<http://data.archiveshub.ac.uk/id/archivalresource/gb162-mss.ind.ocn.s.341> <http://data.archiveshub.ac.
@mcritchlow
mcritchlow / name_test.rb
Created February 6, 2015 19:41
Array#uniq test with Solr document
require 'json'
# test object: bb08540731
# test a file with unique names
uniq_file = File.read('names_uniq_test.json')
json1 = JSON.parse(uniq_file)
names1 = json1['name_tesim']
@mcritchlow
mcritchlow / authority_lookup_sample.rb
Last active December 26, 2015 21:39
This is a sample script for doing linked data lookup starting with string input. The code pings the Library Of Congress /authorities/suggest OpenSearch service. If it finds an exact match, it will query the RDF graph looking for particular Predicates/Values. Further reasoning would be possible here as well. If it doesn't find a match, it will re…
require 'net/http'
require 'json'
require 'linkeddata'
# API reference http://ruby-rdf.github.io/rdf/
#returned results from lookup
result = Hash.new
#define MADS vocabulary for RDF.ruby
@mcritchlow
mcritchlow / sparql_values.rb
Last active February 5, 2016 23:00
A proposed DSL syntax for SPARQL 1.1 VALUES
it "should support VALUES" do
# should support single value construct (less verbose form)
expect(subject.select
.where([:s, RDF::URI('http://purl.org/dc/terms/title'), :title])
.values([:title], ["This title", "Another title"]).to_s)
.to eq "SELECT * WHERE { ?s <http://purl.org/dc/terms/title> ?o . VALUES ?title { 'This title' 'Another title' } }"
# should support single value construct (general form)
expect(subject.select
.where([:s, RDF::URI('http://purl.org/dc/terms/title'), :title])
@mcritchlow
mcritchlow / output.txt
Last active September 22, 2016 15:32
RDF type validation
DBPedia record for UCSD RDF type listing
http://umbel.org/umbel/rc/University
http://dbpedia.org/class/yago/School108276720
http://dbpedia.org/ontology/EducationalInstitution
http://umbel.org/umbel/rc/EducationalOrganization
http://umbel.org/umbel/rc/Organization
http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Agent
http://www.w3.org/2002/07/owl#Thing
http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#SocialPerson
http://dbpedia.org/class/yago/Abstraction100002137

Using Sidekiq in Hyrax

Hyrax no longer packages a default queuing back-end. Hyrax builds its jobs using Rails' ActiveJob framework, so you are free to use the queuing system of you choice (e.g. Resque, DelayedJob, Sidekiq) to manage long-running or slow processes. Flexibility and choice come with a cost, though, and there's some work involved in integrating whichever queueing back-end you select. This page offers guidance on installing and using Sidekiq to handle background jobs in your Hyrax app.

Pre-Requisites: Install and Run Redis

Keybase proof

I hereby claim:

  • I am mcritchlow on github.
  • I am mcritchlow (https://keybase.io/mcritchlow) on keybase.
  • I have a public key ASDyr0WKT0J_Ty-IximEu92jNyzBiz4IhUol2HTgmxKfBwo

To claim this, I am signing this object: