Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
<!--
Description:
This is a date formatting utility for Twitter feeds, modified from the original date-time.xsl file. The named template "twitter-format-date" takes 2 parameters:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="entry" />
<xsl:template match="navigation">
<xsl:param name="area" />
<ul class="clear">
<xsl:attribute name="id">
<xsl:choose>
/*
Collapse Sectionfields for Symphony CMS
1.1 Modified by Dale Tan <[email protected]>
- Rewrote methods in private, anonymous function
- Allows for "toggling" when in "collapsed" view
1.0.1 Modified by Stephen Bau <[email protected]>
- Remove jQuery for Symphony 2.0.3+. jQuery.noConflict mode. Fix margins CSS.
<xsl:template match="body//*">
<xsl:element name="{name()}">
<xsl:apply-templates select="* | @* | text()"/>
</xsl:element>
</xsl:template>
<xsl:template match="body//@*">
<xsl:attribute name="{name(.)}">
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:attribute>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl">
<xsl:import href="../utilities/generic/string-replace.xsl" />
<xsl:strip-space elements="* | @*"/>
<!--
@dtan
dtan / gist:733829
Created December 8, 2010 20:10
sniff out iframe and resize
(function (window) {
function sendChangeHeightMessage() {
var newHeight = window.location.search.substring(1),
par = window.parent.parent,
frameId = 'iframe_sparq',
el = par.document.getElementById(frameId);
if (el != null) {
if (newHeight != "") {
//alert(window.location.search.substring(1));
@dtan
dtan / example_page.xsl
Created March 30, 2011 13:05
Convert XML to JSON output
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:json="http://json.org/"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- this is in the context of Symphony CMS, hence ../utilities -->
<xsl:import href="../utilities/xml2json.xsl"/>
<xsl:output omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
@dtan
dtan / tls.js
Created June 25, 2011 15:46
node tls e
var tls = require('tls')
, fs = require('fs')
, host = 'localhost'
, port = 4001
, options = {
pkey: fs.readFileSync('keys/ssl.key'),
cert: fs.readFileSync('keys/ssl.crt')
}
, handler = function (s) {
s.write('welcome to a secure connection!');
@dtan
dtan / gist:1054996
Created June 29, 2011 21:12
output of node build
~$:/sources/node# ./configure
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for gcc : ok
Checking for library dl : yes
Checking for openssl : not found
@dtan
dtan / gist:1055024
Created June 29, 2011 21:25
node make failure
Waf: Entering directory `/home/admin/sources/node/build'
DEST_OS: linux
DEST_CPU: x64
Parallel Jobs: 1
Product type: program
[ 1/33] copy: src/node_config.h.in -> build/default/src/node_config.h
[ 2/33] copy: tools/nodejs.pc.in -> build/default/tools/nodejs.pc
[ 3/33] cc: deps/libeio/eio.c -> build/default/deps/libeio/eio_1.o
/usr/bin/gcc -rdynamic -D_GNU_SOURCE -pthread -g -O3 -DHAVE_OPENSSL=1 -DHAVE_MONOTONIC_CLOCK=1 -DX_STACKSIZE=65536 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_FDATASYNC=1 -DARCH="x64" -DPLATFORM="linux" -D__POSIX__=1 -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -Idefault/deps/libeio -I../deps/libeio -Idefault -I.. ../deps/libeio/eio.c -c -o default/deps/libeio/eio_1.o
[ 4/33] cc: deps/http_parser/http_parser.c -> build/default/deps/http_parser/http_parser_3.o