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 / 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="/">
@patrickmj
patrickmj / hello.rb
Last active January 2, 2016 07:49
My Code Snippet
2.times do
puts "Hello World"
end
require 'octokit'
require 'csv'
require 'date'
# Description:
# Exports Github issues from one or more repos into CSV file formatted for import into JIRA
# Note: By default, all Github comments will be assigned to the JIRA admin, appended with
# a note indicating the Github user who added the comment (since you may not have JIRA users
# created for all your Github users, especially if it is a public/open-source project:
#
require 'json'
require 'open-uri'
require 'csv'
require 'date'
# Github credentials to access your private project
USERNAME="myusername"
PASSWORD="mypassword"
# Project you want to export issues from
"""
Exports Issues from a specified repository to a CSV file
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
"""
import csv
import requests