Skip to content

Instantly share code, notes, and snippets.

View bewildergeist's full-sized avatar

Dan Okkels Brendstrup bewildergeist

View GitHub Profile
@greystate
greystate / _WYSIWYG.xslt
Created August 25, 2011 20:54
Include file for handling WYSIWYG content for real (as in: XML instead of effin' CDATA...)
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY NiceUrl "umb:NiceUrl">
<!ENTITY Parse "ucom:Parse">
<!ENTITY wrapper "WYSIWYG">
<!ENTITY nbsp "&#160;">
<!ENTITY badStuff "FONT | font | MARQUEE | marquee | BLINK | blink">
<!ENTITY TinyMCEStuff "span[@class = 'Apple-style-span'] | div[@class = 'xmlblock']">
<!ENTITY blackListedElements "&badStuff; | &TinyMCEStuff;">
<!ENTITY embedded-doctype "&lt;!DOCTYPE WYSIWYG [ &lt;!ENTITY nbsp &quot;&amp;#160;&quot;&gt; ]&gt;">
@leekelleher
leekelleher / PaginationExample.xslt
Created August 3, 2011 08:08
Generic XSLT template for pagination with Umbraco
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#x00A0;">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
@greystate
greystate / gist:1042652
Created June 23, 2011 14:37
Conditional sorting by QueryString values
<xsl:variable name="sortByDate" select="umbraco.library:RequestQueryString('sort') = 'date'" />
<xsl:variable name="sortByName" select="umbraco.library:RequestQueryString('sort') = 'name'" />
<xsl:for-each select="$allTheNodesToShow">
<xsl:sort select="@nodeName[$sortByName]" data-type="text" order="ascending" />
<xsl:sort select="@createDate[$sortByDate]" data-type="text" order="descending" />
<p>
<xsl:value-of select="@nodeName" />, created: <xsl:value-of select="@createDate" />
@scottjehl
scottjehl / anchorinclude.js
Created May 20, 2011 17:04
Anchor-include Pattern
/*
* anchor-include pattern for already-functional links that work as a client-side include
* Copyright 2011, Scott Jehl, scottjehl.com
* Dual licensed under the MIT
* Idea from Scott Gonzalez
* to use, place attributes on an already-functional anchor pointing to content
* that should either replace, or insert before or after that anchor
* after the page has loaded
* Replace: <a href="..." data-replace="articles/latest/fragment">Latest Articles</a>
* Before: <a href="..." data-before="articles/latest/fragment">Latest Articles</a>
@greystate
greystate / one-line-toggle.xslt
Created February 8, 2011 23:32
One-liner to assign a variable one of two values, dependent on condition (XSLT 1.0, that is)
<!-- Selects 'YES' if CONDITION is true() -->
<xsl:value-of select="substring('YES|NO', not(CONDITION) * 4 + 1, 3)" />
<!-- Selects 'NO' if CONDITION is true() -->
<xsl:value-of select="substring('YES|NO', boolean(CONDITION) * 4 + 1, 3)" />
<!--
Notes:
* Need both versions because the longer value must be the first of the two
@greystate
greystate / dynamicsort.xslt
Created December 21, 2010 13:18
Dynamically determining sort order in XSLT (in Umbraco) with QueryString parameter
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umb="urn:umbraco.library"
exclude-result-prefixes="umb"
>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
@nils-werner
nils-werner / loop.xsl
Created May 22, 2010 17:31
XSLT Loop
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl">
<xsl:template name="loop"> <!-- Loop -->
<xsl:param name="i" />
<xsl:param name="limit" />
<xsl:call-template name="loop-item">
namespace :fogbugz do
# Usage:
#
# sake fogbugz:branch[source_branch, "My Project"]
#
#
desc "Setup a branch for each case assigned to me."
task :branch, [:target_branch, :project] do |t, args|
#!/usr/bin/env ruby
# Lil' script to fix or implement Fogbugz tickets from the command line.
# Usage:
# Edit `base_uri`.
# fogbugz login [email protected] password
# Copy the returned token and paste on the `default_params` line.
# fogbugz fix 1234 "I IZ TEH AWESOME"
require "rubygems"
require "httparty"