Skip to content

Instantly share code, notes, and snippets.

View joewiz's full-sized avatar

Joe Wicentowski joewiz

  • Arlington, Virginia
View GitHub Profile
@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
@CliffordAnderson
CliffordAnderson / milliseconds-since-epoch.xqy
Last active August 29, 2016 20:32
Milliseconds since Unix Epoch
declare function local:milliseconds-since-epoch($dateTime as xs:dateTime) as xs:integer
{
let $epoch := xs:dateTime("1970-01-01T00:00:00Z")
let $duration := xs:duration($dateTime - $epoch)
let $days := fn:days-from-duration($duration) * 8.64e+7
let $hours := fn:hours-from-duration($duration) * 3.6e+6
let $minutes := fn:minutes-from-duration($duration) * 60000
let $seconds := fn:seconds-from-duration($duration) * 1000
return xs:integer($days + $hours + $minutes + $seconds)
};
@tonyahowe
tonyahowe / tei2html.xql
Created August 16, 2016 20:32
working xql transform file 8/16/2016
module namespace tei2="http://exist-db.org/xquery/app/tei2html";
import module namespace console="http://exist-db.org/xquery/console";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare function tei2:tei2html($nodes as node()*) {
for $node in $nodes
return
typeswitch ($node)
case text() return
@CMCDragonkai
CMCDragonkai / regular_expression_engine_comparison.md
Last active April 30, 2026 16:20
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

(:~
This module converts an XML document into a JSON document.
- Element ordering is preserved.
- Attributes and namespaces are ignored.
- Identical element names become JSON arrays.
Example usage:
let $uri := "somedoc.xml"
let $doc := fn:doc($uri)
return jsontools:jsonify($doc)
@grantmacken
grantmacken / muURL.xqm
Last active June 5, 2024 22:33
xQuery helper functions for dealing with URLs
xquery version "3.0";
(:~
This module contains helper functions for dealing with URLs.
When receiving webmention the post parameter 'source' is a URL pointing to the
origin of the mention.
Before we get and store a sanitized version of an HTML document the url links to
we want to able to
@timathom
timathom / basex-async.xq
Last active March 21, 2016 13:41
Anonymous inline function with asynchronous evaluation in BaseX
(:~
: Anonymous inline function with asynchronous evaluation in BaseX 8.4.1 beta
:
: @param $query Asynchronously evaluated query
: @return XQuery expression, followed by result of async HTTP request.
:
: BaseX Async Module:
: http://docs.basex.org/wiki/Async_Module
:
: Dimitre Novatchev on recursion with anonymous inline functions in XPath 3.0:
@CliffordAnderson
CliffordAnderson / simple-dpla-with-params-xml.xqy
Last active March 21, 2016 13:41
Just a quick example of searching the DPLA API using XQuery and returning a simple webpage.
module namespace page = 'http://library.vanderbilt.edu/dpla';
(: Just a quick example of searching the DPLA API
and returning a simple webpage. :)
declare
%rest:path("dpla/{$search}")
%rest:query-param("key", "{$key}")
%output:method("html")
function page:html($search as xs:string, $key as xs:string)
@wilhelmy
wilhelmy / dirlist.xslt
Last active April 2, 2026 13:16
make nginx dirlistings look like lighttpd's through the magic of xslt-transforming xml dirlistings. I don't even.
<?xml version="1.0"?>
<!--
dirlist.xslt - transform nginx's into lighttpd look-alike dirlistings
I'm currently switching over completely from lighttpd to nginx. If you come
up with a prettier stylesheet or other improvements, please tell me :)
-->
<!--
Copyright (c) 2016 by Moritz Wilhelmy <mw@barfooze.de>
@glueckpress
glueckpress / GitHub-Desktop-Bitbucket.md
Last active February 6, 2025 13:18
[How-to] Use GitHub Desktop to clone and commit to a Bitbucket repository just as you would with any GitHub repository. (Mac)

⚠️ Note: this guide is from 2016 – a long time on the internet. Content may be outdated, check the comments for more recent info.


Clone Bitbucket Repository and Add it to GitHub Desktop App (Mac)

You can’t clone a Bitbucket repo using GithHub Desktop directly. Instead you would have to:

  1. Clone the Bitbucket repo locally via command line.
  2. Add the cloned repository to your GitHub Desktop app.