Skip to content

Instantly share code, notes, and snippets.

View juddlyon's full-sized avatar

Judd Lyon juddlyon

View GitHub Profile
<?php
// Dynamic paths for cross-server compatibility
$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$base_url = $protocol . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];
$system_folder = "system";
$images_folder = "images";
$images_path = $base_path . "/" . $images_folder;
@bkeating
bkeating / wordpress-wxr-example.xml
Created February 23, 2011 16:57
A vanilla example of the WordPress WXR Schema. Im using this as a starting point to build my own comments importer for disqus.com
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<item>
<!-- title of article -->
@makeusabrew
makeusabrew / label-to-placeholder.js
Created May 22, 2011 18:32
Simple jQuery snippet to convert form labels into inline placeholders
$("form :input").each(function(index, elem) {
var eId = $(elem).attr("id");
var label = null;
if (eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) {
$(elem).attr("placeholder", $(label).html());
$(label).remove();
}
});
@alexkingorg
alexkingorg / hex_color_mod.php
Created September 3, 2011 23:42
Change the brightness of the passed in hex color in PHP
<?php
/**
* Change the brightness of the passed in color
*
* $diff should be negative to go darker, positive to go lighter and
* is subtracted from the decimal (0-255) value of the color
*
* @param string $hex color to be modified
* @param string $diff amount to change the color
@mdekstrand
mdekstrand / pdf-thumbnail.sh
Created February 1, 2012 17:56
Generate thumbnails of PDF files
#!/bin/sh
for file in "$@"; do
outfile="${file%%.pdf}.jpg"
echo "Thumbnailing $file to $outfile"
convert -resize 300 "$file[0]" "$outfile"
done
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@croxton
croxton / stash_nested_embeds.md
Created October 29, 2012 14:23
Stash & template partials - nested embed

Required:

Stash 2.3.4 (beta) or later

Stash template directory

	/layouts/
		standard.html

	/partials/

listing.html

@jamiepittock
jamiepittock / ExpressionEngine template
Created November 23, 2012 11:48
Inject events from low_events:entries into low_events:calendar cells
{exp:low_events:calendar
events_field="cf_events_date_time"
date="{freebie_4}"
}
<table class="calendar" cellspacing="0" cellpadding="0">
<thead>
<tr id="month_pager">
<th colspan="1" class="previous"><a href="{structure:page:uri}
on/{prev_month_url}" title="{prev_month format='%F %Y'}">&larr;</a></th>
<th colspan="5" class="month_title"><a href="{structure:page:uri}
@DavidWittman
DavidWittman / clouddns-export.py
Last active December 12, 2018 01:06
Exports all domains for a Rackspace Cloud account in BIND9 format
#!/usr/bin/env python
import json
import os
import time
import clouddns
USERNAME = ''
APIKEY = ''
@brandonkelly
brandonkelly / templating.md
Last active February 7, 2024 15:20
Templating in EE vs. Craft