Skip to content

Instantly share code, notes, and snippets.

@jlafitte
jlafitte / api.js
Last active December 16, 2015 02:58
My spas-simple modification to support passing through a header object.
var request = require("request"),
_ = require("underscore")._;
/*
# Simple API Request
*/
exports["request"] = function(params, credentials, cb) {
var reqString = params.url,
@jlafitte
jlafitte / sam-href-override-extended.xsl
Last active December 16, 2015 02:39
SAM href-override extended functionality. When there is a manual override specified, in SAM Admin it will show a message to the user so they know the page will not be seen. In stage and publish it will create script and fallback meta tag to redirect the page. Technically meta tags are meant to be in the head block, my testing seems to indicate i…
<xsl:variable name="href-override" select="/SAM/navigation/link[@id = /SAM/page/@id]/href-override" />
<xsl:if test="$href-override">
<xsl:choose>
<xsl:when test="@directive = 'admin'">
<p class="error" style="text-align:center">
This page is redirecting to <a href="{$href-override}" target="_blank"><xsl:value-of select="$href-override"/></a>.<br />
You may change this in Architecture &gt; Edit Page Info &gt; Edit Advanced &gt; Manual URL Override.
</p>
</xsl:when>
<xsl:otherwise>
@jlafitte
jlafitte / string-replace-all.xsl
Created July 13, 2012 23:57
A replace-all XSL template. Very useful if you are stuck in XSLT 1.0 world, but made obsolete in XSLT 2.0+
<xsl:template name="string-replace-all">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="by"/>
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$by"/>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="substring-after($text,$replace)"/>