Skip to content

Instantly share code, notes, and snippets.

View bess's full-sized avatar

Bess Sadler bess

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<titles type="array">
<title>
<title>Shakespeare and Company Project Dataset: Lending Library Members, Books, Events</title>
<title-type nil="true"/>
</title>
</titles>
<description>Shakespeare and Company Project Dataset: Lending Library Members, Books, Events</description>
<creators type="array">
@bess
bess / blacklight_dynamic_sitemap_setup.md
Last active February 17, 2022 17:07
blacklight_dynamic_sitemap setup

Configuring blacklight_dynamic_sitemap

For pdc_discovery, a blacklight application at Princeton to improve findability for open access data sets, we want to publish a sitemap so that search engine crawlers can more easily index our content. Orangelight, Princeton's library catalog, which is also a Blacklight application, uses an older system, blacklight-sitemap. However, blacklight-sitemap hasn't been updated in awhile, and using rake tasks to re-generate very large sitemaps is less than ideal because it takes time and the sitemaps become stale quickly. Given these drawbacks to our existing approach, I was excited to try the more recent solution in use at Stanford and Penn State (among others): blacklight_dynamic_sitemap.

Jack Reed, one of the authors of this solution, has a good [blog post](https://www.jack

@bess
bess / hyrax_and_globus.md
Created February 12, 2021 19:46
Summary of Globus / Hyrax integration

Globus Download in Hyrax

Globus is a tool for transferring very large datasets. It has many advantages over older systems for transferring files, and researchers are increasingly expecting that data repositories should offer Globus integration. While there is not yet an official Globus integration offering from the Samvera community, several institutions have integrated Globus into their repository systems. Notch8 was recently asked to write such an integration for the Hyrax-based Rutgers Virtual Data Collaboratory. This blog post will describe the research and design process for this, as well as provide links to some sample code and pointers for future development.

Previous Work

As we undertook this work, we were aided greatly by conducting informational interviews with Nabeela Jaffer at the University of Michigan, and David Chandek-Stark at Duke University. UM and Duke have implemented similar strategies for Globus integration, w

Keybase proof

I hereby claim:

  • I am bess on github.
  • I am eosadler (https://keybase.io/eosadler) on keybase.
  • I have a public key ASDTGkEztXBuqdHklXp2ErAQRT9FxfQkZKZSArN0f3VE3go

To claim this, I am signing this object:

@bess
bess / blacklight_advanced_search_in_hyku.md
Last active November 4, 2020 21:28
blacklight_advanced_search_in_hyku.md

Adding blacklight_advanced_search to Hyku

I was recently asked to add Blacklight Advanced Search to a Hyku app for the US Department of Transportation. It was a little tricky, so I’m documenting the process in the hopes of making life easier for the next person who has to do this.

Many thanks to Dean Farrell at UNC Libraries for pointing me at UNC’s hy-c implementation, where blacklight advanced search is installed into Hyrax: https://github.com/UNC-Libraries/hy-c/pull/421/files

David Kinzer’s Blacklight Search Notes are also excellent background reading: https://gist.github.com/dkinzer/4f6dbb4634dbbdc99255dbea6305ccae

Write a feature spec first

@bess
bess / visibility_bug_hunt.md
Last active October 23, 2020 22:00
Going on a bug hunt

Bug Hunting in Hyrax

I recently had to find a bug in a Hyrax application, and I thought it might be helpful if I documented the process.

1. Define the problem

I like to start a bug hunt with a clear description of what exactly I’m trying to solve. A great place to do this is in a ticket on the team’s board. In this case, the problem was that when new works were submitted to Hyrax via the create work form, the visibility was not being persisted. I find it helpful to write out the bug definition as a user story:

As a content contributor, when I submit a new work through the form, I want to be able to make it public so that it will be visible to the world. Instead, the work always ends up being marked as restricted / private. 
require 'logger'
require 'cgi'
##
# Sample Ruby delegate script containing stubs and documentation for all
# available delegate methods. See the user manual for more information.
#
# The application will create an instance of this class early in the request
# cycle and dispose of it at the end of the request cycle. Instances don't need
# to be thread-safe, but sharing information across instances (requests)
# **does** need to be done thread-safely.
@bess
bess / rails_42_with_active_support.rb
Created March 11, 2020 12:14 — forked from tonytonyjan/rails_42_with_active_support.rb
session cookie decrypter for Rails
require 'cgi'
require 'json'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base)
cookie = CGI::unescape(cookie)
salt = 'encrypted cookie'
signed_salt = 'signed encrypted cookie'
key_generator = ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000)
secret = key_generator.generate_key(salt)
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@type": "sc:Manifest",
"@id": "http://localhost:3000/manifest.json",
"label": "al-Bayān wa-al-iʻrāb ʻammā bi-arḍ Miṣr min al-Aʻrāb / Aḥmad ibn ʻAlī al-Maqrīzī",
"description": "Treatise on the Arab tribes which settled in Egypt.",
"metadata": [
{
"label": "Creator",
"value": "Maqrīzī, Aḥmad ibn ʻAlī, 1364-1442"
- hosts: 'uw'
name: ensure python is installed for ansible
user: ubuntu
gather_facts: false
pre_tasks:
- name: update apt cache
become: yes
package: update_cache=yes
- name: upgrade apt packages