Skip to content

Instantly share code, notes, and snippets.

View patrickmj's full-sized avatar

Patrick Murray-John patrickmj

  • Digital Scholarship Group, Snell Library, Northeastern University
  • Boston, MA
  • X @patrick_mj
View GitHub Profile
@patrickmj
patrickmj / DrsItemResponse.js
Last active October 27, 2023 19:00
Draft ideas for DRS API response
/*
* This is an example single item API response, using the Image_Payload in this repo as a starting point.
*
* It merges how IIIf files and manifests are handled.
*
* It also includes simplified variations of the element names from XML. I think they align closely
* enough with the XML version to be recognizable without losing semantics, at least for what CERES
* needs.
*
* Elements below query and result are optional, unless otherwise noted (or if I don't get an HTTP 200 response,
@patrickmj
patrickmj / APIstructures.js
Last active April 10, 2020 14:33
Drafts of API query and response structures for various Notheastern Library DH projects. Only here for sharing and discussion -- nothing actually implemented.
/*
* First passes as possible API query and response structures
* for various Northeastern Library DH projects
*
*
*
*/
// Work / Item data
// /item/{id}
@patrickmj
patrickmj / blocksVariableDefinitions.js
Last active March 20, 2019 14:40
Trying to figure out the difference in JS between these ways of doing WP Gutenberg blocks
// I've seen code for building WP blocks with JS like this
( function( blocks, editor, i18n, element) {
var el = element.createElement;
var __ = i18n.__;
var RichText = editor.RichText;
// do block things
}(
window.wp.blocks,
window.wp.editor,
@patrickmj
patrickmj / gist:1cc0958ea913abf28736d7936ac71918
Last active January 12, 2019 06:24
Quick web page to find possible years for date/day combo
<!-- Save all this to wherever (copy-paste from the Raw code should work), the open it in a browser.
If there are problems, I'll move it to a real GitHub repo for issue reporting.
(It's had minimal testing)
-->
<html>
<head>
<script type='text/javascript'>
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "https://data.ucd.ie/api/img/manifests/ivrla:7173",
"rendering": {
"@id": "https://digital.ucd.ie/get/ivrla:7173/content",
"format": "application/pdf",
"label": "Download as PDF"
},
@patrickmj
patrickmj / EmbargoAclAssertion.php
Created December 2, 2015 22:58
Partial hiding of files in Omeka
<?php
class EmbargoAclAssertion implements Zend_Acl_Assert_Interface
{
public function assert(
Zend_Acl $acl,
Zend_Acl_Role_Interface $role = null,
Zend_Acl_Resource_Interface $resource = null,
$privilege = null)
{
@patrickmj
patrickmj / alto2txt.xslt
Created March 5, 2015 19:37
Extract text from ALTO xml files
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:a="http://www.loc.gov/standards/alto/ns-v2#"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
>
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<?php
echo metadata('collection', array('Dublin Core', 'Description'));
?>
@patrickmj
patrickmj / plugin.php
Created March 25, 2014 14:47
Simple Om eka plugin to deny contributor permissions
<?php
add_plugin_hook('define_acl', 'deny_contributors_define_acl');
function deny_contributors_define_acl($args)
{
$acl = $args['acl'];
$acl->deny('contributor','Collections', array('add', 'delete-confirm', 'editSelf',
'deleteSelf', 'showSelfNotPublic'));
}
@patrickmj
patrickmj / RequiredMetadataPlugin.php
Created March 17, 2014 19:09
Required Metadata for Omeka plugin work
<?php
class RequiredMetadataPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_hooks = array('before_save_item');
protected $_filters = array(
'itemTitleLengthValidator' => array('Validate', 'Item', 'Dublin Core', 'Title'),
);
public function hookBeforeSaveItem($args)