Skip to content

Instantly share code, notes, and snippets.

View ethangardner's full-sized avatar

Ethan Gardner ethangardner

View GitHub Profile
ethangardner / GoogleCDNfallback.html
Created October 5, 2010 17:43
code snippet to offer fallback to local file if google's ajax api is unavailable
<!-- From -->
<!-- Grab Google CDN's jQuery. fall back to local if necessary -->
<script src=""></script>
<script>!window.jQuery && document.write('<script src="js/jquery-1.4.2.min.js"><\/script>')</script>
ethangardner / yql_flickr.php
Created December 21, 2010 02:02 — forked from avinashbangar/yql_flickr.php
using yql to access flickr photos via api
Following code gets information about photos from Flickr via YQL for the given search term
Author : avinash
Email :
<h2>Using YQL to Access the Flickr API</h2>
<form name='upcoming_form'>
ethangardner / Mootools-1.2-XML-parsing.js
Created January 11, 2011 22:21
Mootools 1.2 XML sitemap parsing
new Request({
url: '/sitemap.xml',
method: 'get',
onSuccess: function(responseText, responseXML) {
responseXML.getElements('url').each(function(url) {
ethangardner / MooTools-1.3-XML-parsing.js
Created January 11, 2011 23:03
MooTools 1.3 XML parsing with Slick
//XHR to retrieve an atom feed and parse the result
//with MooTools Slick selector engine
new Request({
url: '/index.php?format=feed&type=atom',
data : 'xml',
method: 'get',
onComplete: function(responseText, responseXML) {
console.log(, 'entry > title'));
ethangardner / combine-files-from-command-line.txt
Created January 28, 2011 19:37
Combine Multiple Files using Linux or Cygwin command line
#code from article at
echo "1. Combining Javascript"
# Combine all the javascript to a single temporary file
cat $JSDIR/mootools-1.2-core.js \
$JSDIR/mootools-1.2-more.js \
$JSDIR/functions.js \
ethangardner / prevent-IE-console-errors.js
Created January 30, 2011 18:18
Prevent console errors from IE if left in JS
// Prevents web inspector and firebug console errors from appearing in IE
// if a debugging flag is accidentally left in somewhere.
// originally from
if (!window.console) {
(function() {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
ethangardner / XML-attributes-to-elements.xsl
Created March 2, 2011 21:54
XML attributes to elements
<?xml version="1.0" encoding="UTF-8"?>
<!-- original source is -->
<xsl:output method="html" encoding="UTF-8"/>
<xsl:strip-space elements="*" />
<xsl:template match="*">
<xsl:copy >
<xsl:if test="@*">
ethangardner / jquery-wp-footer.php
Created April 7, 2011 13:39
Load jQuery in the footer of Wordpress.
ethangardner / yql-twitter-dashboard.php
Created June 28, 2011 23:39
YQL Twitter Dashboard
<table id="social-media" class="tablesorter">
<caption>Twitter Dashboard with YQL</caption>
<th>Account Name</th>
<th>Last Tweet</th>
ethangardner / xsl-restaurant-menu-1.xml
Created June 28, 2011 23:44
XSL Restaurant Menu 1
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="menu.xsl"?>
<section name="Appetizers">
<summary>Start your meal with something hot and fresh</summary>
<title>Appetizer Title 1</title>
<description>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</description>