This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// uber-simple color fader (very limited) | |
// see http://jsfiddle.net/cowboy/XWaNe/ | |
function hex_pct(base,pct){ | |
return base.replace( /00|ff/ig, function(a){ | |
var scale = 0.8, | |
pct_adj = Math.max( 0, Math.min( 1, pct ) ) * scale + ( 1 - scale ) / 2, | |
val = ( pct > 0.5 ? ( pct_adj - 0.5 ) : pct_adj ) * 2 * 255; | |
return pct_adj != 0.5 && ( ( pct_adj > 0.5 ) == ( a == '00' ) ) ? ( '0' + parseInt(val).toString(16) ).substr(-2) : a; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Indent with opt-tab | |
### http://benalman.com/grab/6e0f7b.png | |
#!/usr/bin/perl -w | |
$tab_soft = ' ' x $ENV{'TM_TAB_SIZE'}; | |
$tab_hard = "\t"; | |
$tab = $ENV{'TM_SOFT_TABS'} eq "YES" ? $tab_soft : $tab_hard; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
var supports_onhashchange = 'onhashchange' in window, | |
last_hash = location.hash, | |
timeout_id; | |
$.event.special.hashchange = { | |
setup: function() { | |
if ( supports_onhashchange ) { return false; } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//EnhanceJS isIE test idea | |
//detect IE and version number through injected conditional comments (no UA detect, no need for cond. compilation / jscript check) | |
//version arg is for IE version (optional) | |
//comparison arg supports 'lte', 'gte', etc (optional) | |
var isIE = (function(){ | |
var doc = document, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ========================= | |
// SetInterval | |
// ========================= | |
// While not truly accurate, setInterval is still fairly good, time-wise. | |
// Better for things like a "one second tick" but not great for expensive | |
// code executed at small intervals as iterations can "stack". | |
// (ECMAScript 5 strict mode compatible) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The jQuery way. | |
$(elem).bind( 'foo.bar', function(event){ | |
do_something( event.target ); | |
}).triggerHandler( 'foo.bar' ); | |
// The old-school silly way. | |
function fn( event ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rough "widget factory" pattern idea. Maybe dumb, but I'm just fooling | |
// around at the moment. | |
(function($,undefined){ | |
'$:nomunge'; // Used by YUI compressor. | |
var widget_name = 'myWidget', | |
default_method = 'init', | |
default_data = {}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- OLD, but amusing nonetheless | |
-- http://www.wowinterface.com/downloads/info6813-CowboysMasterBaiter.html | |
-- INIT | |
CB_MB = {}; | |
CB_MB.Version = "20006.003"; | |
function CB_MB:OnLoad() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mHUD version 5.0 | |
// | |
// (c) 8/9/99 Cowboy, don't modify this without my permission | |
// - | |
// New in 5.0: NewOpts support! (see the NewOpts HELP for info, please!) | |
// | |
// Let me know of any BUGS, thanks. My email is [email protected] | |
// - | |
// NOTE: Requires Presto Pack 0.93 or greater! | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rough implementation, untested, etc | |
// Will obviously fail when non-overridden methods are used to change the DOM | |
(function($){ | |
// All "DOM modifying" methods (probably not complete). | |
var methods = 'unwrap html wrapApp wrapInner append appendTo html prepend prependTo text after before insertAfter insertBefore'.split(' '); | |
$.each( methods, function( i, method ) { | |
// Store a reference to the original method. |