Skip to content

Instantly share code, notes, and snippets.

View jlogsdon's full-sized avatar

James Logsdon jlogsdon

View GitHub Profile
#!/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`
<!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-/, '');
<?php
$result = mysql_query("SELECT * FROM content_field_hours LIMIT 1");
while ($row = mysql_fetch_assoc($result)) {
var_dump($row);
}
/* Outputs
array(3) {
<?php
/**
* Implementation of hook_theme()
*/
function module_theme($existing, $type, $theme, $path) {
$theme = array();
$base = array(
'path' => "{$path}/theme",
'file' => 'theme.inc'
<?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
// 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!
}
<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>