Skip to content

Instantly share code, notes, and snippets.

View ethangardner's full-sized avatar

Ethan Gardner ethangardner

View GitHub Profile
$(document).ready(function(){
var icons = $('.icons'),
icon = icons.find('li'),
numIcons = icon.length,
openIcon = Math.floor(Math.random()*icon.length),
iconContainer = $('.feature-box'),
expandedClass = 'expanded',
collapsedClass = 'collapsed';
$(icon[openIcon]).addClass(expandedClass);
/**
* Add whatever reset you want to use here -
* I am using Eric Meyer's CSS reset
*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dd, dl, dt, li, ol, ul, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
line-height: 1;
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Feature Box</title>
<link rel="stylesheet" href="assets/styles/momentum.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="assets/scripts/jquery.scrollTo-min.js"></script>
<script src="assets/scripts/featurebox.js"></script>
</head>
@ethangardner
ethangardner / gist:1277100
Created October 11, 2011 02:09
Wordpress Accordion Widget Area
<?php
// Accordion widget area
if (is_active_sidebar('accordion-widgets')) : ?>
<div id="accordion" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'accordion-widgets' ); ?>
</div><!-- #accordion -->
<?php endif; ?>
@ethangardner
ethangardner / gist:1277054
Created October 11, 2011 01:35
Create the structure for jQuery UI Accordion
// This goes in the functions.php file between the php tags
// to make wordpress render the markup needed for a jQuery UI
// accordion widget area
register_sidebar(array(
'name' => 'Accordion Widget Area',
'id' => 'accordion-widgets',
'description' => 'jQuery UI accordion enabled widget area',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h3><a href="#">',
@ethangardner
ethangardner / gist:1276957
Created October 11, 2011 00:25
Include jQuery and jQuery UI via Wordpress functions.php
// add this to the theme's functions.php
// file between the php tags
if(!is_admin()){
wp_deregister_script('jquery');
wp_register_script('jquery', ('https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js'), false, '1.6.4');
wp_enqueue_script('jquery');
wp_deregister_script('jquery-ui');
wp_register_script('jquery-ui', ('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'), false, '1.8.16');
wp_enqueue_script('jquery-ui');
}
@ethangardner
ethangardner / xsl-even-results.xsl
Created September 21, 2011 17:51
Applies an alternate class to even numbered results in XSL
<xsl:if test="position() mod 2 != 1">
<xsl:attribute name="class">alt</xsl:attribute>
</xsl:if>
@ethangardner
ethangardner / remove-script-from-joomla.php
Created September 21, 2011 17:39
Remove script tag from the head of Joomla templates for non-admin users
<?php
$user =& JFactory::getUser();
if ($user->get('guest') == 1) {
$headerstuff = $this->getHeadData();
$headerstuff['scripts'] = array();
$this->setHeadData($headerstuff);
}
?>
@ethangardner
ethangardner / using-temlates.xsl
Created September 21, 2011 17:35
Using templates instead of foreach in XSL
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<h3 id="keynotes">Keynotes</h3>
<ul class="none" id="speakers">
<xsl:apply-templates />
</ul>
</xsl:template>
@ethangardner
ethangardner / string-replace.sql
Created September 21, 2011 17:33
MySQL String Replace
UPDATE [table name] SET [table column] = REPLACE([table column],"[original string]","[new string]")