Skip to content

Instantly share code, notes, and snippets.

View jlogsdon's full-sized avatar

James Logsdon jlogsdon

View GitHub Profile
<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:choose>
<xsl:when test="contains($text, '&#xA;')">
<xsl:value-of select="substring-before($text, '&#xA;')"/>
<br/>
<xsl:call-template name="break">
<xsl:with-param name="text" select="substring-after($text,'&#xA;')"/>
</xsl:call-template>
</xsl:when>
<?php
// Magic quotes will end us all, so remove any quotes added by it
if (get_magic_quotes_gpc()) {
function _rss($v) {
$f = __FUNCTION__;
if (is_array($v)) {
foreach ($v as $k => $j) {
$v[$k] = $f($j); // yay recurssion!
}
<?php
/**
* This script should be passed a GET parameter named "file" with the relative path
* to the .less file.
*
* If .css is used instead of .less, it will be replaced with .less when looking for
* the file.
*
* I personally use an internal redirect that matches the .css extension and rewrites
<?php
/**
* Implementation of hook_theme()
*/
function module_theme($existing, $type, $theme, $path) {
$theme = array();
$base = array(
'path' => "{$path}/theme",
'file' => 'theme.inc'
<?php
$result = mysql_query("SELECT * FROM content_field_hours LIMIT 1");
while ($row = mysql_fetch_assoc($result)) {
var_dump($row);
}
/* Outputs
array(3) {
<!doctype html>
<html>
<head>
<title>Fluid Resize Dimensions</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
$(function() {
$(window).bind('resize', function() {
$('div[class^="span-"]').each(function() {
var span = $(this).attr('class').replace(/span-/, '');
#!/usr/bin/env php
<?php
/**
* `grep` is faster for single terms.
*
* `grep -i .php /path/to/access.log`
*
* vs.
*
* `this-script /path/to/access.log .php`
#!/bin/bash
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
BDIR=/mnt/backup # Backup directory
TDIR=/var/trac # Trac directory
SDIR=/var/svn # SVN directory
MDIR=/var/lib/mysql # MySQL directory
HDIR=/home # Home directory
DATE=`date +%Y-%m-%d`
[20:00:08] Creating backup of Trac projects
[20:00:08] 10perimeterpark (656815)
[20:00:11] 2115piedmont (800928)
[20:00:12] aaps (1247372)
[20:00:13] acme (578997)
[20:00:14] acs (825498)
[20:00:15] acs-corporate (702622)
[20:00:16] afclients (2225320)
[20:00:17] ajff (6858629)
[20:00:18] alcan (787072)
<?php
use \lithium\security\Auth;
use \lithium\util\String;
Auth::config(array(
'account' => array(
'adapter' => 'Form',
'model' => 'Account',
'fields' => array('login'),