Skip to content

Instantly share code, notes, and snippets.

View aaronmcadam's full-sized avatar
🎉
Having fun!

Aaron McAdam aaronmcadam

🎉
Having fun!
View GitHub Profile
@aaronmcadam
aaronmcadam / jquery.textchange.js
Created June 16, 2010 01:47 — forked from mkelly12/jquery.textchange.js
jQuery Text Change Event
(function ($) {
$.event.special.textchange = {
setup: function (data, namespaces) {
$(this).bind('keyup.textchange', $.event.special.textchange.handler);
$(this).bind('cut.textchange paste.textchange input.textchange', $.event.special.textchange.delayedHandler);
},
teardown: function (namespaces) {
@aaronmcadam
aaronmcadam / gist:440401
Created June 16, 2010 09:48 — forked from paulirish/gist:403386
jQuery( elem :any(el) ... )
// Idea from http://dbaron.org/log/20100424-any
jQuery.expr[':'].any = function(el, i, match) {
return jQuery.find.matches(match[3], [el]).length > 0;
};
jQuery('body :any(div, form) p'); // Same as jQuery('body div p, body form p')
jQuery('div:any(.foo,.bar)'); // Same as jQuery('div.foo, div.bar')
@aaronmcadam
aaronmcadam / smart_toggle.js
Created June 17, 2010 22:44
smart_toggle not used on NM
$('.sound a').toggle(function(e) {
$("#slider-horizontal").css('margin', '10px').slideDown('fast');
// Deactivate any actively toggled elements first:
// $(this).closest("div.podcast").each(ACTIVATE).siblings("div.podcast").each(DEACTIVATE)
$('.slider-vertical').eq(index).each(function(){ $(this).css('margin', '10px').slideDown('fast'); })
.siblings('.slider-vertical').each(function(){ $(this).slideUp('fast'); });
e.preventDefault();
}, function(e) {
@aaronmcadam
aaronmcadam / old_nm.js
Created June 22, 2010 19:31
old_nm.js
$(document).ready(function() {
// Calling the Bubble Up plugin on the social icons in the header
$('#icon_container ul li img').bubbleup({tooltip: true, scale:66});
// Create an array of URLS to mp3s which are stored in links with a class of 'audio'
var mp3s = $('.audio').map( function() { return this.href; } ).toArray();
var clipIndex = 0; // setting Clip index variable
// install flowplayer into container
@aaronmcadam
aaronmcadam / ee_twitter_plugin_example.html
Created July 5, 2010 21:59
ee_twitter_plugin_example
{exp:twitter_timeline_oauth url="http://example.com" limit="3" twitter_refresh="20" auto_link="true"
link_usernames="true" link_hashtags="true"}
{if {count} == "0"}
<p>No results</p>
{/if}
<div class="tweet">
<div class="info"><a href="http://www.twitter.com/{screen_name}">{screen_name}</a> / {created_at format="%g:%i %A %M %d"}</div>
<div class="text">{text}</div>
<div class="clear"></div>
</div>
<noscript>
<h2>Comments:</h2>
{exp:disqust:get_thread_posts}
</noscript>
<!--
You can return the number of posts by calling the plugin like {exp:disqust:get_thread_posts display_total_posts="yes"}
Example:
@aaronmcadam
aaronmcadam / out wcag accessibility.html
Created September 2, 2010 09:16
jquery cycle with focus accessibility
<script type="text/javascript" src="/includes/jquery.cycle.lite.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var controls = $("#controls"), sliderContainer = $("#mainFocus");
$("#slides").cycle({
fx : "fade",
speed : "slow",
timeout : 12000,
next : "#next",
prev : "#prev",
@aaronmcadam
aaronmcadam / DeletingMultipleTablesInSQL.sql
Created September 9, 2010 11:07
Delete multiple tables
DELETE a, b
FROM `dt_orders` AS a, `dt_purchases` AS b
WHERE `Email_Address` = '[email protected]'
AND a.id = b.OrderID
@aaronmcadam
aaronmcadam / ucfirstXSLT.xslt
Created September 10, 2010 15:19
upper case first letter in xslt
<xsl:variable name="firstChar" select="substring(/page/colour,1,1)"/>
<xsl:variable name="productColour">
<xsl:value-of select="translate($firstChar,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/><xsl:value-of select="substring-after(/page/colour,$firstChar)"/>
</xsl:variable>
@aaronmcadam
aaronmcadam / dynamically_getting_node_name_in_xslt.xslt
Created September 15, 2010 10:10
This will select the first nodename from a list of nodes dynamically
<!-- This will select the first nodename from a list of nodes dynamically for future reference -->
<xsl:variable name="nodename" select="'nodename'"/>
<xsl:value-of select="./*[local-name() = $nodename]" disable-output-escaping="yes" />