Skip to content

Instantly share code, notes, and snippets.

View joewiz's full-sized avatar

Joe Wicentowski joewiz

  • Arlington, Virginia
View GitHub Profile
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2025 16:56
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@CliffordAnderson
CliffordAnderson / example-hof.md
Last active January 3, 2024 15:40
Simple examples of higher-order functions and partial function application in XQuery

##Examples of Higher-Order Functions in XQuery

Here are a few examples of higher-order functions in XQuery. For more examples, see the very nice discussion of higher-order functions in XQuery 3.0 at the BaseX website.

N.B. In some implementations, these functions may not be implemented or may have different names/function signatures. The first four functions have been tested using Saxon PE and the second four using Zorba.

@wsalesky
wsalesky / git-sync.xql
Last active August 19, 2019 08:58
Sync remote eXistdb with github repository automatically using github webhooks.
xquery version "3.0";
(:module namespace gitsync = "http://syriaca.org/ns/gitsync";:)
(:~
: XQuery endpoint to respond to Github webhook requests. Query responds only to push requests.

: The EXPath Crypto library supplies the HMAC-SHA1 algorithm for matching Github secret. 

:
: Secret can be stored as environmental variable.
: Will need to be run with administrative privileges, suggest creating a git user with privileges only to relevant app.
@tmuth
tmuth / pandoc-ant.xml
Created November 10, 2014 19:14
Pandoc Ant Task to Convert github README.md to local readme.html
<macrodef name="pandoc-convert">
<attribute name="input" />
<attribute name="output" />
<sequential>
<exec executable="pandoc" dir=".">
<arg line="--from=markdown_github " />
<arg line="--standalone" />
<arg line="-o @{output}" />
<arg line="@{input}" />
</exec>
@RobTrew
RobTrew / ParseAllOPMLAttributes.js
Last active May 11, 2024 06:49
PARSE LOCAL OPML FILE IN OS X 10.10 JXA USING $.NSXMLDocument (parsing 'text' + all other attributes)
// PARSE LOCAL OPML FILE IN OS X 10.10 JXA USING $.NSXMLDocument
// Ver 2.0 Parse all attributes (ver 1 just parsed text)
function run() {
var app = Application.currentApplication();
app.includeStandardAdditions = true;
function readTextFromFile(strPath) {
return $.NSString.stringWithContentsOfFile(strPath);
}
@CliffordAnderson
CliffordAnderson / cities.xqy
Last active August 29, 2015 14:14
IE-TN Data
xquery version "3.0";
<cities>{
let $names :=
"Adelaide
Adelaide
Adelaide and Windsor
Adelaide Station
Agangarrive Hill
Aghadovey
Aghadowey
@wsalesky
wsalesky / facets.xqm
Created February 6, 2015 18:49
XQuery Facets POC
xquery version "3.0";
(:~
: A facet library module
:
: Builds facets from nodes passed by search or browse modules.
: Uses group by
: Built for use with eXistdb, if using with eXistdb be sure to define your range
: indexes in your collectio.xconf file for best performance.
:
: @author Winona Salesky
@CliffordAnderson
CliffordAnderson / comp.R
Last active August 29, 2015 14:17
Compare the annual GDP growth in China and the United States
# Load libraries
library(ggplot2)
library(Quandl)
# Load datasets from Quandl
USA <- Quandl("WORLDBANK/USA_NY_GDP_MKTP_KD_ZG", authcode="[TOKEN")
China <- Quandl("WORLDBANK/CHN_NY_GDP_MKTP_KD_ZG", authcode="[TOKEN")
# Merge datasets into single table
Comp <- China
@CliffordAnderson
CliffordAnderson / say-howdy.xqy
Created March 27, 2015 17:29
A working example of the Say-Howdy function
xquery version "3.0";
declare function local:say-howdy ($name as xs:string*) as xs:string
{
if (fn:count($name) >1) then "Howdy, " || fn:string-join($name, " and ") || "!"
else "Howdy, " || $name || "!"
};
(: local:say-howdy("Dave") :)
local:say-howdy(("Dave", "Laura"))
@jeffreycwitt
jeffreycwitt / gist:cb4ab709db98f1317d4b
Created May 16, 2015 20:57
A ruby script to auto load git repos into webdav mounted exist volume
#!/usr/bin/env ruby
require 'bundler/setup'
require 'lbp'
puts "welcome to the scta index loader"
puts "i'm going to help you load git repos into the existdb database"
local_load_dir = "/Volumes/db-1/apps/scta/"
remote_load_dir = "/Volumes/db/apps/scta/"
use_load_dir = remote_load_dir