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
// Only load this in if the version of jQuery is prior to 1.6 | |
if(parseFloat(jQuery.fn.jquery) < 1.6){ | |
jQuery.map = (function(_oldmap){ | |
return function(){ | |
var elems = arguments[0], | |
length = elems.length, | |
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ((length > 0 && elems[0] && elems[length -1]) || jQuery.isArray(elems)); |
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
/* | |
* So it seems my "complete" callback is never called when I have a header of 400 or 404 set. Any ideas? | |
*/ | |
// My PHP file.. | |
header("Content-Type: application/json"); | |
header('HTTP/1.1 400 Bad Request'); | |
$response = array( | |
'status' => 'error', |
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
// 100x faster than Sizzle: https://github.com/jquery/sizzle | |
// 50x faster than Qwery: https://github.com/ded/qwery | |
function fastQueryQuicklySpeedyAndKingOfRapidness(selector){ | |
if(!document.querySelectorAll){ | |
alert('Sorry buddeh. Plz upgrade yur browsr to harness the real power of this awsome app i builded.'); | |
return; | |
} | |
return document.querySelectorAll(selector); |
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
/* | |
* Full example here: http://jsfiddle.net/jboesch26/3SKsL/1/ | |
*/ | |
$.fn.outerHTML = function(){ | |
// IE, Chrome & Safari will comply with the non-standard outerHTML, all others (FF) will have a fall-back for cloning | |
return (!this.length) ? this : (this[0].outerHTML || ( | |
function(el){ | |
var div = document.createElement('div'); |
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
if(isset($_POST['post_comment'])){ | |
if(stristr('SEO', $_POST['message'])){ | |
die('fuck off'); | |
} | |
} |
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. Change the line at the bottom that detects YourLib::isLocal() to whatever you want to use for detecting if you're running locally. This just outputs the mail message if we are local. | |
// 2. Add <?= $this->Session->flash('email'); ?> to your default.ctp view. This is where the debug email will output to (if you're running locally) | |
// 3. Copy the below into a file called custom_email_component.php | |
// 4. Now in your controller or wherever, call it: public $components = array('CustomEmail'); | |
// 5. Use exactly like you would the Email component, eg. $this->CustomEmail->to = '[email protected]' | |
/** | |
* The reason we're extending CakePHP's email component is because | |
* we don't want to repeat ourselves when sending mail. This allows us | |
* to plug in some defaults like "$from" and $this->delivery = 'debug' if |
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
// Step 1: Include jQueryify bookmarklet from http://www.learningjquery.com/2006/12/jquerify-bookmarklet | |
// Step 2: Plug this into your console. | |
var total = []; | |
$('.cur_val[headers=gross]').each(function(){ | |
var t = $.trim(this.innerHTML.replace('$', '').replace(',','')); | |
/* PayPal has two selectors of .cur_val[headers=gross] that point to the same amount. | |
We only want the one with a space in it, cause tht tells us whether or not it's CAD/USD */ | |
if(t.indexOf(' ') > -1){ | |
total.push(t); | |
} |
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
jQuery version (does not work): http://jsfiddle.net/MLqS4/1/ | |
Native version (works fine): http://jsfiddle.net/cq84C/1/ |
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
// http://jsfiddle.net/w5TnB/5/ | |
// HTML | |
<div class="myclass ui-dialog ui-widget ui-blah something"> | |
<a href="#">REMOVE ALL CLASSES WITH UI PREFIX</a> | |
</div> | |
// Regular jQuery | |
$('a').click(function(){ | |
$(this).parent().removeClass('ui-* something'); | |
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
<? | |
/** | |
* Some versioned URL's for cache busting when we push new changes up | |
* Only need the file name, paths will resolve appropriately in the | |
* $file_path variable | |
* Usage: <?= vurl('myfile.js'); ?> | |
* | |
* @param $file {String} The file - eg. 'file.js' or 'file.css' | |
* @param $type {String} We can optionally specify a type (probably not needed) | |
*/ |