Skip to content

Instantly share code, notes, and snippets.

@vicmortelmans
vicmortelmans / gist:798257
Created January 27, 2011 08:53
XML data + XSL stylesheet for browser + CSS in single file (useful for DMS publishing), including vertical table headers with wrapped text as bonus
<?xml-stylesheet type="text/xsl" href="#"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- the main concept of this file is obtained from
http://stackoverflow.com/questions/360628/embed-xsl-into-an-xml-file -->
<xsl:output omit-xml-declaration="yes"/>
<xsl:key name="reviewers" match="reviewer" use="."/>
<!-- browsers have XSLT 1.0, so 'for-each-group' must be implemented
@vicmortelmans
vicmortelmans / flatten.xslt
Created January 28, 2011 15:04
templates for flattening a purely hierarchical XML structure
<!-- templates for flattening a purely hierarchical XML structure
into a list of <item> records -->
<xsl:template match="*" mode="flatten">
<xsl:apply-templates mode="flatten"/>
</xsl:template>
<xsl:template match="*[not(*)]" mode="flatten">
<!-- working upwards starting from leaf nodes -->
<item>
@vicmortelmans
vicmortelmans / txt2optionhtml.pl
Created June 24, 2011 10:29
Perl script that transforms a list of strings into an HTML select element
#!/usr/bin/perl
use HTML::Entities;
print "<select>\n";
while (<STDIN>) {
chop;
$s = encode_entities($_);
print "<option value=\"$s\">$s</option>\n";
}
print "</select>\n";
function escape(t)
{
var r='';
for(var i=0;i<t.length;i++){
var c=t.charCodeAt(i);
var t1=Math.floor(c/16);
var t2=c%16;
if (t1<10) t1+=48;
else t1+=55;
if (t2<10) t2+=48;
@vicmortelmans
vicmortelmans / gist:1393077
Created November 25, 2011 08:54
TEA encryption
// use (16 chars of) 'password' to encrypt 'plaintext'
function encrypt(plaintext, password) {
var v = new Array(2), k = new Array(4), s = "", i;
plaintext = escape(plaintext); // use escape() so only have single-byte chars to encode
// build key directly from 1st 16 chars of password
for (var i=0; i<4; i++) k[i] = Str4ToLong(password.slice(i*4,(i+1)*4));
@vicmortelmans
vicmortelmans / gist:1453419
Created December 9, 2011 21:39
XSLT to turn YQL Open Table "csv" output with <row>s and <col>s into semantically structured XML based on title row
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<rows>
<xsl:apply-templates select="//row"/>
</rows>
</xsl:template>
@vicmortelmans
vicmortelmans / doctrinafidei.xslt
Created April 7, 2012 21:37
XSLT to turn YQL html open table output for http://www.doctrinafidei.va/ into XML that can be read by Yahoo Pipes to be turned into an RSS feed
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:o="urn:schemas-microsoft-com:office:office"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<data>
<xsl:apply-templates/>
</data>
</xsl:template>
@vicmortelmans
vicmortelmans / custom-ruleset-eo.parametrized.xml
Created April 12, 2012 17:12
Custom ruleset for LiturgyCalendar XML/XSLT toolset
<?xml version="1.0" encoding="UTF-8"?>
<liturgicaldays>
<locale>en-us</locale>
<form>eo</form>
<includeliturgicaldays>https://raw.github.com/vicmortelmans/LiturgyCalendar/master/liturgy.calendar.roman-rite.general.eo.ruleset.parametrized.xml</includeliturgicaldays>
<options>epiphany-alt,ascension-std,corpuschristi-std</options>
<cacheservice>http://prentenmissaal.my28msec.com/cache/cache?doc=calendar&amp;expiration=0&amp;url=$url</cacheservice>
<restservice>http://xslt.childrensmissal.appspot.com/calendar?output=xml&amp;ruleset=$ruleset&amp;mode=$mode&amp;cache=$cache&amp;date=$date&amp;set=$set&amp;score=$score&amp;minrankprecedence=$minrankprecedence&amp;coordinates=$coordinates&amp;year=$year</restservice>
<cachefolder>file:///C:/temp</cachefolder>
<liturgicalday>
@vicmortelmans
vicmortelmans / custom-ruleset-eo-local.parametrized.xml
Created April 12, 2012 18:34
Custom ruleset for LiturgyCalendar XML/XSLT toolset - running locally - only general calendar
<?xml version="1.0" encoding="UTF-8"?>
<liturgicaldays>
<locale>en-us</locale>
<form>eo</form>
<includeliturgicaldays>
https://raw.github.com/vicmortelmans/LiturgyCalendar/master/liturgy.calendar.roman-rite.general.eo.ruleset.parametrized.xml</includeliturgicaldays>
<options>epiphany-std,ascension-std,corpuschristi-std</options>
<cacheservice></cacheservice>
<restservice></restservice>
<cachefolder>file:///C:/temp</cachefolder>
@vicmortelmans
vicmortelmans / radioPlayerLiveConfiguration.json
Last active October 25, 2022 05:52
Radio Player Live configuration
[{"id":0,"name":"Radio Maria Nederland","mrl":"http://www.radiomaria.nl/upload/userfiles/file/webstream.pls","category":"Christian","logo":"","favorite":"fav.png","web":"http://www.radiomaria.nl","source":"Soutcast","type":"MP3"},{"name":"Radio Maria Vlaanderen","mrl":"http://stream.radiomaria.be/RadioMaria-96.m3u","category":"Christian","logo":"","favorite":"fav.png","web":"www.radiomaria.be","id":1,"type":""},{"id":2,"name":"Gregoriaans","mrl":"http://streams.greenhost.nl:8080/gregoriaans","category":"Christian","logo":"","favorite":"fav.png","web":"http://concertzender.nl/"},{"name":"Oude Muziek","mrl":"http://streams.greenhost.nl:8080/oudemuziek","category":"Christian","logo":"","favorite":"fav.png","web":"http://concertzender.nl/","id":3},{"name":"Jazz","mrl":"http://streams.greenhost.nl:8080/jazz","category":"Christian","logo":"","favorite":"fav.png","web":"http://concertzender.nl/","id":4},{"name":"Nieuwe Muziek","mrl":"http://streams.greenhost.nl:8080/nieuwemuziek","category":"Christian","logo":"","fa