Skip to content

Instantly share code, notes, and snippets.

Allen Chang allen

Block or report user

Report or block allen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View master.xml
<data>
<people>
<item id='1'>Fred</item>
<item id='2'>Jane</item>
<item id='3'>Bob</item>
<item id='4'>Mary</item>
<item id='6'>Tom</item>
</people>
<people-details>
<entry id='1'>
@allen
allen / html-character-truncate.xsl
Created Feb 17, 2009
Truncates by character limit while gracefully retains HTML elements.
View html-character-truncate.xsl
<?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">
<!--
Author: Allen Chang
Version: 1.1
Description: Truncates by character limit while gracefully retains HTML
Usage: <xsl:apply-templates select="path/to/your/body" mode="truncate"/>
-->
View master.xml
<?xml version="1.0" encoding="UTF-8"?>
<data>
<events>
<event>
<title>Recurring Exciting Event</title>
<date>2012-01-01</date>
<end-date>2014-12-31</end-date>
<recurring>yes</recurring>
<recurring-number>2</recurring-number>
<recurring-type>weeks</recurring-type>
View master.xml
<?xml version="1.0" ?>
<ds-count-products-by-category>
<item handle="compressors">compressors</item>
<item handle="compressors">compressors</item>
<item handle="complete-plants">complete-plants</item>
<item handle="complete-plants">complete-plants</item>
<item handle="chillers">chillers</item>
<item handle="chillers">chillers</item>
<item handle="chillers">chillers</item>
<item handle="chillers">chillers</item>
View master.xml
<?xml version="1.0" encoding="UTF-8"?>
<data>
<plant-of-the-month>
<section id="20" handle="plant-of-the-month">plant of the month</section>
<entry id="99">
<genus handle="fgfg">fgfg</genus>
<common-name handle="ggfdgb">ggfdgb</common-name>
<latin-name handle="dghgh">dghgh</latin-name>
<flowers-jan>Yes</flowers-jan>
<flowers-feb>Yes</flowers-feb>
View master.xml
<data>
<remote>
<data>
<preferences>
<sitename>Client - Portfolio</sitename>
<languages>
<entry id="1" handle="english" lang="en">English</entry>
<entry id="2" handle="francais" lang="fr">Francais</entry>
</languages>
<stylesheets>
@allen
allen / symphony-2.3-post.markdown
Created May 28, 2012
Symphony 2.3 Release Announcement
View symphony-2.3-post.markdown

Last year, a baker once asked me, "Do you want icing on your cake?" Now, if there is just one thing you need to know about me, it would be that my answer is always, "Yes, ALL the icing." This year, I've gone back to my baker to get a new cake. And before I continue with my fictitious story, yes, I have an appointed baker, like I do with tailors, hairdressors and manicurists. I'm an important man, dammit.

Okay, onwards with my tale: every year, without fail, the baker asks me the same question about cake icing. I don't have to tell you again--unless you have the memory of a goldfish--that it's always an "affirmative" on the icing. All of it.

But this year, I had a new thought. An inception planted by Symphonists inside a dream I was having while dreaming about cake. I didn't just want icing. I wanted a new cake. I always get Black Forest chocolate cake; had it for years. Black Forest is old news, joining among the likes of carrot cakes. Customers can no longer tolerate messy and hard to eat cakes. Kids

@allen
allen / enkoder.xsl
Created Jan 16, 2012
XSLT Utility: Enkoder
View enkoder.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="enkoder">
<script type="text/javascript">
<xsl:text disable-output-escaping="yes">&#x0A;//&lt;![CDATA[&#x0A;</xsl:text>
<xsl:comment>
<xsl:text>&#x0A;<![CDATA[var x="function f(x){var i,o=\"\",ol=x.length,l=ol;while(x.charCodeAt(l/13)!" +]]></xsl:text>
<xsl:text>&#x0A;<![CDATA["=48){try{x+=x;l+=l;}catch(e){}}for(i=l-1;i>=0;i=i-1){o+=x.charAt(i);}return o" +]]></xsl:text>
<xsl:text>&#x0A;<![CDATA[".substr(0,ol);}f(\")001,\\\"771\\\\syhb100\\\\_220\\\\000\\\\VUZ620\\\\RZEY" +]]></xsl:text>
You can’t perform that action at this time.