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
// Moved to: | |
// http://github.com/cowboy/jquery-misc/blob/master/jquery.ba-isjquery.js | |
// http://github.com/cowboy/jquery-misc/blob/master/jquery.ba-isjquery.min.js |
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
## also see http://github.com/cowboy/bash-misc/blob/master/bash_prompt.sh | |
# ssh | |
ps aux | grep ssh-agent | grep -v grep > /dev/null 2>&1 || eval $(ssh-agent) | |
alias ssh_key='ssh-add -l | grep id_rsa > /dev/null 2>&1 || ssh-add' | |
# git | |
alias gst='git status' | |
alias gl='ssh_key && git pull' |
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 ($) { | |
$.event.special.load = { | |
add: function( handler, data, namespaces ) { | |
if ( /^img$/i.test( this.tagName ) && ( this.complete || this.readyState === 4 ) ) { | |
// If element is IMG and has been cached by IE, trigger the event explicitly. | |
var event = jQuery.Event( 'load' ); | |
event.data = data; | |
handler.call( this, 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
/*! | |
* Throttle + Debounce - v0.2 - 2/5/2010 | |
* http://benalman.com/ | |
* | |
* Copyright (c) 2010 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
*/ | |
// Returns a function that will, when called repeatedly, execute `callback` no |
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
// This has moved to: | |
// http://github.com/cowboy/jquery-misc/blob/master/jquery.ba-viewportoffset.js | |
// http://github.com/cowboy/jquery-misc/blob/master/jquery.ba-viewportoffset.min.js |
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
// This has moved to: | |
// http://github.com/cowboy/jquery-misc/blob/master/jquery.ba-scrollbarwidth.js | |
// http://github.com/cowboy/jquery-misc/blob/master/jquery.ba-scrollbarwidth.min.js |
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
// 1.4.2 (new plugins, use this) | |
$.event.special.foo = { | |
add: function( handleObj ) { | |
// Do something when event is bound here! | |
var old_handler = handleObj.handler; | |
handleObj.handler = function(event) { | |
// handleObj.type (string, 'foo' in this case) | |
// handleObj.data (anything) |
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
test( 'async tests', function() { | |
// My custom async function | |
function ajax(data, successCallback) { | |
$.ajax({ | |
url: 'server.php', | |
data: data, | |
success: successCallback, | |
error: function( xhr, textStatus ){ | |
ok( false, textStatus ); |
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
var a = 1; | |
(function(){ | |
var a = 2; | |
(function(parent){ | |
var global = this; | |
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
################################################################ | |
name: jQuery plugin closure | |
tab trigger: jqp | |
scope selector: source.js | |
code: | |
(function(\$${2:,window}${3:,undefined}){ | |
'$:nomunge'; // Used by YUI compressor. | |
${0:// OMG LETS MAKE A PLUGIN!!} | |