Skip to content

Instantly share code, notes, and snippets.

@hacklschorsch
hacklschorsch / tmx_filename_patch_to_zf
Created January 19, 2012 17:27
Patch to Zend Framework 1.11.4 to add filename to exception description when TMX parsing fails
Index: library/Zend/Translate/Adapter/Tmx.php
===================================================================
--- library/Zend/Translate/Adapter/Tmx.php (revision 3015)
+++ library/Zend/Translate/Adapter/Tmx.php (working copy)
@@ -74,9 +74,10 @@
xml_set_character_data_handler($this->_file, "_contentElement");
if (!xml_parse($this->_file, file_get_contents($filename))) {
- $ex = sprintf('XML error: %s at line %d',
+ $ex = sprintf('XML error: %s at line %d of file %s',
@hacklschorsch
hacklschorsch / xslt_google_wetter_3.xslt
Created December 19, 2011 23:29
XSL transform the Google Weather Feed into HTML (sorry, the annotations are in German)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict">
<credit>Florian Sesser für CoSeTrain</credit>
<credit_URL>http://www.cosetrain.com/</credit_URL>
@hacklschorsch
hacklschorsch / mysql_backup_cron
Created December 5, 2011 10:28
Rolling MySQL snapshots in two lines of code
# Scope: Back up the MySQL database
# Author: Florian Sesser <fs@it-agenten.com>
# Date: 2011-11-11, 2011-12-05
# This script is to be placed into /etc/cron.d/ (it's a cron config file)
# We are on a debian-based distribution and use the debian-sys-maint
# account. If you need to create an account for backup purposes, it
# has to have permissions to "read" and "lock tables:
#