Skip to content

Instantly share code, notes, and snippets.

Joe Wicentowski joewiz

View GitHub Profile
@jamescummings
jamescummings / tei_minimal-new.odd
Created Jun 23, 2019
A proposed new tei_minimal.odd which really is minimal
View tei_minimal-new.odd
<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title>TEI Minimal</title>
<author>James Cummings</author>
</titleStmt>
<publicationStmt>
<publisher>TEI Consortium</publisher>
@luisenriquecorona
luisenriquecorona / Sales.CustomerOrderSummary.sql
Created May 1, 2019
To demonstrate the use of the XQuery methods in this chapter, we will create a table in the WideWorldImporters database, called Sales. CustomerOrderSummary. This table can be created using the script
View Sales.CustomerOrderSummary.sql
USE WideWorldImporters
GO
CREATE TABLE Sales.CustomerOrderSummary
(
ID INT NOT NULL IDENTITY,
CustomerID INT NOT NULL,
OrderSummary XML
);
INSERT INTO Sales.CustomerOrderSummary (CustomerID,
OrderSummary)
@line-o
line-o / example.xq
Last active Jun 19, 2019
xquery implementation to format dateTime in Internet Message Format
View example.xq
xquery version "3.1";
import module namespace imfd='http://existsolutions.com/apps/imfd' at '/db/temp/imfd.xqm';
let $now := current-dateTime()
let $tz := timezone-from-dateTime($now)
let $imfd := imfd:format($now)
let $gmt := imfd:to-dateTime($imfd)
let $reversed := adjust-dateTime-to-timezone($gmt + $tz, $tz)
@adamretter
adamretter / dtx.xqm
Last active Jan 22, 2020
Date/Time/DateTime XQuery functions
View dtx.xqm
import module namespace functx = "http://www.functx.com";
(: NOTE -- functx uses 1 to 7 to represent MON-SUN, whereas eXist-db's datetime module used 1 to 7 to represent SUN-SAT :)
declare variable $local:MON := 1;
declare variable $local:TUES := 2;
declare variable $local:WEDS := 3;
declare variable $local:THURS := 4;
declare variable $local:FRI := 5;
declare variable $local:SAT := 6;
@grantmacken
grantmacken / .env
Last active Feb 19, 2019
Use prove to get TAP output from running #existdb unit tests
View .env
NAME=newBase60
CONTAINER=exDev
PORT=8282
USE_DC_OVERRIDE=yes
DC_OVERRIDE_NETWORK=www
@xquery
xquery / topo.xqy
Created Feb 8, 2019
example topo sort in xquery
View topo.xqy
declare function local:topo-sort($unsorted, $sorted ) {
if (empty($unsorted)) then $sorted
else
let $allnodes := $unsorted [ every $id in depends/@id satisfies $id = $sorted/@id]
return
if ($allnodes) then
local:topo-sort( $unsorted except $allnodes, ($sorted, $allnodes ))
else ()
};
View data-composition.xqy
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 :)
@adamretter
adamretter / exist-message-digest-algs.txt
Last active Nov 13, 2018
MessageDigest algorithms offered by eXist-db
View exist-message-digest-algs.txt
PROVIDER | ALGORITHM
-----------|------------
SUN
MD2
MD5
SHA
SHA-224
SHA-256
SHA-384
SHA-512
@line-o
line-o / pw-reset.xq
Last active Nov 8, 2018
Rough sketch of a password reset for eXist-db
View pw-reset.xq
xquery version '3.1';
(:~
this script must be run with a user in the DBA group
add this line to your post-install script or run it manually
it will set the GID sticky bit
chown('/path/to/this/script.xq', 'admin', 'dba')
chmod('/path/to/this/script.xq', 'rwxr-S---')
:)
@wsalesky
wsalesky / git-commit.xql
Created Oct 12, 2018
XQuery to commit content to GitHub. Query creates a new branch, commits content and creates a new pull request to specified repository.
View git-commit.xql
xquery version "3.1";
(:~
: POC: XQuery to commit content to github reop via github API. Tested in eXist-db v4.4.0
: Code creates a new branch off of the master branch, commits updated content to the new branch
: and then submits a pull request when complete. Intended use is for online data submission,
: using GitHub for review/approval process.
:
: Prerequisites:
: In order to run the module, you will need a github Authorization token.
You can’t perform that action at this time.