Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / Ode to Paul Irish
Created October 25, 2009 20:50
Fork this shit, yo
"Ode to Paul Irish"
There once was a jQuery master from Boston,
whose soul-piercing eyes you could get lost in.
He gave some cool talks,
which knocked off my socks,
and now he's the daddy of my children.
HTML
====
<p>jQuery BBQ enables simple, yet powerful bookmarkable #hash history via a cross-browser window.onhashchange event. In addition, jQuery BBQ provides a full jQuery.deparam() method, along with both fragment and query string parse and merge utility methods.</p>
<p><strong>This plugin and the <a href="http://benalman.com/projects/jquery-urlinternal-plugin/">jQuery urlInternal</a> plugin supersede the URL Utils plugin.</strong></p>
<ul>
<li>Release v1.0.2</li>
<li>Tested with jQuery 1.3.2 and jQuery 1.4pre in Internet Explorer 6-8, Firefox 2-3.6, Safari 3-4, Chrome, Opera 9.6-10.</li>
<!--
My "generic" HTML structure (used in benalman.com and others)
An array of main sections:
page = [ { header: [] }, { content:[] }, ... ];
Bodies are pushed onto each of those, which are all iterated over
to form this structure:
@cowboy
cowboy / gist:230314
Created November 9, 2009 22:05
some problematic movable type template code
<mt:SetVarBlock name="current_page_body">
<mt:Unless name="current_page_category_is_date">
<mt:SetVar name="_sort_by" value="title">
<mt:SetVar name="_sort_order" value="ascend">
</mt:Unless>
<mt:Entries tags="NOT (@hidden OR @nonav)" lastn="$int_category_recent_entries_count" sort_by="$_sort_by" sort_order="$_sort_order">
<mt:Var name="entry_summary">
<mt:Var name="hr">
</mt:Entries>
<mt:SetVarBlock name="more_recent_entries">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>oops?</title>
<script type="text/javascript" src="http://benalman.com/code/jquery/dist/jquery.js"></script>
<script type="text/javascript" language="javascript">
<!--
/*!
* jQuery ie6ize: Emulate IE-6 rendering - 11/13/2009
* http://mankzblog.wordpress.com/2009/11/13/ie6-frame-to-battle-chrome-frame/
*
* Created by Mats Bryntse
*
* Plugin-ified by "Cowboy" Ben Alman
* http://benalman.com/
*
* Bookmarklet version:
var obj = {
prop: 'foo',
method1: function(){ return this.prop; }
};
obj.method2 = function(){ return this.method1(); };
function bindify( obj, name, fn ) {
obj[ name ] = function(){
return fn.apply( obj, arguments );
// ============================== //
// 1
// ============================== //
// create
var q = $.qq({
delay: 100,
oneach: function( item ) { console.log( item ); }
});
// Try this in the Firebug console on:
// http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/
//
// Screenshot:
// http://benalman.com/grab/2535b7.png
(function($){
function get_route() {
var hash = $.param.fragment(),
/*!
* JavaScript domReplace - v1.0pre - 11/18/2009
* http://benalman.com/projects/javascript-dom-replace/
*
* Copyright (c) 2009 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// jQuery not required: