Skip to content

Instantly share code, notes, and snippets.

View timathom's full-sized avatar

Tim Thompson timathom

  • Yale University Library
  • New Haven, CT
View GitHub Profile
@wsalesky
wsalesky / move.xhtml
Created January 26, 2022 13:55
Testing XSLTForms and HTML5 drag and drop functionality.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<head>
<title>Insert with Origin</title>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', (event) => {
function handleDragStart(e) {
this.style.opacity = '0.4';
dragSrcEl = this;
@ewg118
ewg118 / kerameikos-template.xml
Last active May 28, 2021 21:00
Kerameikos template for OpenRefine, to export into Linked Art compliant CIDOC-CRM
<crm:E22_Man-Made_Object rdf:about="{{cells['URL'].value}}">
<crm:P1_is_identified_by>
<crm:E33_E41_Linguistic_Appellation>
<crm:P190_has_symbolic_content>{{cells['Title'].value}}</crm:P190_has_symbolic_content>
<crm:P2_has_type rdf:resource="http://vocab.getty.edu/aat/300404670"/>
</crm:E33_E41_Linguistic_Appellation>
</crm:P1_is_identified_by>
<crm:P1_is_identified_by>
<crm:E42_Identifier>
<crm:P190_has_symbolic_content>{{cells['Acc. no.'].value}}</crm:P190_has_symbolic_content>
@thisismattmiller
thisismattmiller / para.json
Created August 2, 2019 19:55
Paranthetical text in the Name Authority File
[
[
"(England)",
71852
],
[
"(Musical group)",
67364
],
[
xquery version "3.0";
(: the power of algebraic data types in xquery
This example shows how we can composite up data models
which 'carry' their own operations along with them.
:)
(: using John Snelson's inspirational https://github.com/jpcs/data.xq :)
@jindrichmynarz
jindrichmynarz / cbd.rq
Created February 24, 2018 18:20
Recursive concise bounded description
# SPARQL 1.1 implementation of concise bounded description (<https://www.w3.org/Submission/CBD>).
PREFIX : <http://example.com/>
PREFIX non: <http://non/>
CONSTRUCT {
:resource ?p1 ?r1 .
?r2 ?p2 ?r3 .
}
WHERE {
@joewiz
joewiz / an-introduction-to-recursion-in-xquery.md
Last active January 3, 2024 15:30
An introduction to recursion in XQuery

An introduction to recursion in XQuery

  • Created: Nov 28, 2017
  • Updated: Nov 29, 2017: Now covers transformation of XML documents

Recursion is a powerful programming technique, but the idea is simple: instead of performing a single operation, a function calls itself repeatedly to whittle through a larger task. In XQuery, recursion can be used to accomplish complex tasks on data that a plain FLWOR expression (which iterates through a sequence) cannot, such as transforming an entire XML document from one format into another, like TEI or DocBook into HTML, EPUB, LaTeX, or XSL-FO. Transforming a document is well-suited to recursion because each of the document's nodes may need to be examined and manipulated based on the node's type, name, and location in the document; and once a node has been processed, the transformation must continue processing the nodes' children and descendants until the deepest leaf node has been processed. But learning the technique of recursion is often hard for a beginning program

@tomasklapka
tomasklapka / webid_gen.sh
Last active October 5, 2019 12:06
WebID generation bash script (requires openssl)
#!/bin/bash
BITS=2048
DIR=./out
if grep -q 'webid_generator' /etc/ssl/openssl.cnf; then
echo "WEBID_GEN: Found webid_generator configuration section in /etc/ssl/openssl.cnf"
else
echo "WEBID_GEN: Section webid_generator is missing in /etc/ssl/openssl.cnf. Add this configuration section manually:
@risdenk
risdenk / .block
Last active December 26, 2016 14:57 — forked from mbostock/.block
Force-Directed Layout from XML
license: gpl-3.0
@mgeeky
mgeeky / execve.c
Created November 17, 2016 16:59
Example of simple execve("/bin/sh", ...) shellcode, embedded in C program.
/*
* Example of simple execve('/bin/sh', ...); shellcode compiled
* and embedded within C program, then compiled on 64-bit with NX bit
* turned off and set executable stack.
*
* Compilation:
* $ gcc -fno-stack-protector -z execstack execve1.c -o execve1c
*/
/*
@wsalesky
wsalesky / facets.xqm
Last active September 20, 2016 13:58
Partial facet implementation for eXist-db based on the EXPath specifications (http://expath.org/spec/facet)
xquery version "3.0";
(:~
: Partial facet implementation for eXist-db based on the EXPath specifications (http://expath.org/spec/facet)
:
: Uses the following eXist-db specific functions:
: util:eval
: request:get-parameter
: request:get-parameter-names()
:
: @author Winona Salesky