This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
import module namespace util="http://exist-db.org/xquery/util"; | |
let $href := "${url}" | |
let $base64flag := true() | |
let $alogo := 'md5' | |
let $hash := replace(util:hash($href, $alogo, $base64flag), '(=+$)', '') | |
return | |
translate( $hash, '+/', '-_') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare | |
function post:archive-feed($node as node(), $model as map(*)) { | |
let $itemCount := function( $seq ){ | |
if( count( $seq ) eq 1 ) | |
then( string(count( $seq )) || ' post') | |
else( string(count( $seq )) || ' posts') } | |
let $getMonth := function( $month ){ | |
('January', 'February', 'March', 'April', 'May', 'June','July', 'August', ' | |
September', 'October', 'November', 'December')[$month] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
module namespace trigger = "http://exist-db.org/xquery/trigger"; | |
declare namespace xhtml = "http://www.w3.org/1999/xhtml"; | |
declare namespace atom = "http://www.w3.org/2005/Atom"; | |
declare namespace repo="http://exist-db.org/xquery/repo"; | |
import module namespace system = "http://exist-db.org/xquery/system"; | |
import module namespace util = "http://exist-db.org/xquery/util"; | |
import module namespace xmldb = "http://exist-db.org/xquery/xmldb"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import re | |
import sys | |
import datetime | |
import math | |
import codecs | |
import argparse | |
import fileinput | |
import markdown2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml.html import tostring, fromstring, html5parser | |
from pygments import highlight | |
from pygments.formatters import HtmlFormatter | |
from pygments.lexers import guess_lexer, get_lexer_by_name | |
from pygments.filters import VisibleWhitespaceFilter | |
# hack hack ... | |
# ignore code contained in pre. I just want the text in the pre | |
def flatten(elem, include_tail=0): | |
text = elem.text or "" | |
for e in elem: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
let $trim := function($arg){ | |
replace(replace($arg,'\s+$',''),'^\s+','') | |
} | |
let $hashTag := function( $input ){ | |
let $flags := '' | |
let $pattern := "(^|\s)((#)([A-Za-z]+[A-Za-z0-9_]{1,15}))(\s|$)" | |
let $replacement := '<span>$1<a href="/tag/$3">$4</a>$5</span>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
let $createShortDate := function ($date){ | |
let $nYear := substring(format-date($date, "[Y]", 'en', (), ()), 3, 4) | |
let $nDaysOfYear := format-date($date, "[d]", 'en', (), ()) | |
let $padDaysOfYear := | |
if( string-length($nDaysOfYear) = 1) then ( '0' || '0' || $nDaysOfYear ) | |
else if( string-length($nDaysOfYear) = 2) then ( '0' || $nDaysOfYear ) | |
else($nDaysOfYear) | |
let $nStr := $nYear || $padDaysOfYear |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<target name="xar-build-upload" > | |
<buildnumber file="build.version"/> | |
<property name="project.version" value="${version.major}.${build.number}"/> | |
<property name="xar-location" value="${dir.project}/${dir.build}/${project.abbrev}-${project.version}.xar"/> | |
<property name="repo.url" value="http://${host.local}:8080/exist/apps/public-repo/public/"/> | |
<property name="repo.update" value="http://${host.local}:8080/exist/apps/public-repo/modules/update.xql"/> | |
<property name="xar-file" value="${project.abbrev}-${project.version}.xar"/> | |
<echo>project.version: ${project.version}</echo> | |
<antcall target="deployment-folder"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################################### | |
# nginx-install.sh | |
#Grant MacKenzie <[email protected]> | |
#v0.1, April 2013 | |
# | |
#Installing nginx | |
#^^^^^^^^^^^^^^^^ | |
# | |
#Nginx server: the latest stable version of | |
# http://wiki.nginx.org/Install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ./nginx-production.sh | |
#=========== | |
#Grant MacKenzie <[email protected]> | |
#v0.1, May 2013 | |
#................................................................................ | |
# dBin='~/bin' | |
# if [ ! -d ~/bin ] ; then | |
# mkdir ~/bin | |
# fi | |
# git clone https://gist.github.com/5381105.git |
NewerOlder