Skip to content

Instantly share code, notes, and snippets.

View nils-werner's full-sized avatar

Nils Werner nils-werner

View GitHub Profile
@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">
<ul>
<xsl:apply-templates select="/data/categories/entry[not(parent)]" />
</ul>
<xsl:template match="categories/entry">
<xsl:param name="path" select="''" />
<li id="{title/@handle}">
<a href="{$root}{$path}{title/@handle}/">
<xsl:value-of select="title" />
public function grab(&$param_pool=NULL){
// I am not able to access $param_pool, so I'm taking a detour via Frontend::Page()
$page = Frontend::Page();
// CREATE XML DOCUMENT
$doc = new DOMDocument;
$root = $doc->createElement($this->dsParamROOTELEMENT);
$doc->appendChild($root);
// APPEND ARTICLES
@nils-werner
nils-werner / field.date.php
Created November 29, 2010 10:35
Original Version
<?php
Class fieldDate extends Field{
const SIMPLE = 0;
const REGEXP = 1;
const RANGE = 3;
const ERROR = 4;
private $key;
@nils-werner
nils-werner / gist:721650
Created November 30, 2010 13:10
URL encode/decode
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
ISO-8859-1 based URL-encoding demo
Written by Mike J. Brown, mike@skew.org.
Updated 2002-05-20.
No license; use freely, but credit me if reproducing in print.
@nils-werner
nils-werner / e
Created December 14, 2010 17:07
Some simple shellscripts for launching my texteditor and a git GUI
#!/bin/bash
if [ $# = 0 ]; then
killall gedit &> /dev/null
/usr/bin/gedit "$(pwd)/$(ls -1p | grep -v \/$ | head -n 1)" &> /dev/null &
else
/usr/bin/gedit "$@" &> /dev/null &
fi
<?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="rbga-to-hex">
<xsl:param name="rgba-val"/>
<xsl:param name="count" select="1"/>
<xsl:variable name="val" select="substring-before($rgba-val,',')"/>
<xsl:variable name="tail" select="substring-after($rgba-val,concat($val,','))"/>
<![CDATA
dies ist ein Test
]]>
Hallo
<p>
Testparagraph
</p>
@nils-werner
nils-werner / clone
Created April 13, 2011 11:46
Clone a repo, replace the origin remote and initialize all submodules
#!/bin/bash
cd $(pwd)
git clone $1 .
git submodule update --init
git remote rm origin
git remote add upstream $1
git remote add origin $2
#
# Put this file in any of the directories of your PATH (try echo $PATH to see them)
#
@nils-werner
nils-werner / Makefile
Created April 29, 2011 09:07
Makefile for Palm SDK
#
# Makefile for Palm WebOS SDK
#
# By default, this Makefile installs and launches apps on the Emulator. To override this
# behaviour override the variable DEVICE to be "usb". i.e. make reinstall DEVICE=usb
#
PACKAGE = com.yourdomain.yourapp
DEVICE = tcp
LEVEL = info