Skip to content

Instantly share code, notes, and snippets.

@johnantoni
johnantoni / supersleight.plugin.js
Created April 14, 2011 08:20
Supersleight jQuery Plugin for Transparent PNGs in IE6
jQuery.fn.supersleight = function(settings) {
settings = jQuery.extend({
imgs: true,
backgrounds: true,
shim: 'x.gif',
apply_positioning: true
}, settings);
return this.each(function(){
if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) {
@johnantoni
johnantoni / setAllToMaxHeight
Created April 13, 2011 13:01
setAllToMaxHeight (jquery)
$.fn.setAllToMaxHeight = function(){
return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
}
// usage: $(‘div.unevenheights’).setAllToMaxHeight()
// http://www.broken-links.com/2009/01/20/very-quick-equal-height-columns-in-jquery/
@Mottie
Mottie / jQuery Enable-Disable
Last active September 25, 2015 10:18
Enable or disable objects using jQuery
/* Enable or disable DOM objects
* This is a basic script - it won't determine
* if an object can be enabled or disabled
*
* Use: $('button').disable();
* $('button').enable();
*/
(function($){
$.fn.extend( {
enable : function(){
@johnantoni
johnantoni / tinyMCE fix for jquery validation
Created December 20, 2010 17:54
tinyMCE fix for use with jQuery.validation plugin and IE
// when using the jquery.validation plugin with a tinymce textarea you will need to write the contents of the tinymce area back into the original textarea for jquery.validation to pick up it's new value
// force tinymce content to be written back into original textarea element
var content = tinyMCE.activeEditor.getContent();
$("textarea.tinymce").val(content);
// if all else fails
tinyMCE.triggerSave();
after this you can safely apply jquery validation ala...
@Mottie
Mottie / gist:461498
Created July 2, 2010 15:19
Return URL Paramater Value
/* Returns URL parameter
* url: http://www.somesite.com?name=hello&id=11111
* z = gup('name'); // z = hello; s = string, or leave blank to target window location
* Original code from Netlobo.com (http://www.netlobo.com/url_query_string_javascript.html)
*/
function gup(n,s){
n = n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var p = (new RegExp("[\\?&]"+n+"=([^&#]*)")).exec(s || window.location.href);
return (p===null) ? "" : p[1];
}
@fabeat
fabeat / README
Created May 4, 2010 11:02
MYSQL SLUG FIX (Unique fix)
MYSQL SLUG FIX
The table 'content' contains pages with a slug. This slug should be unique but it isn't.
unique_fix.sql fixes this problem and makes the slug-column unique.
@paulirish
paulirish / gist:373253
Created April 21, 2010 00:08
jquery invert
// jquery invert plugin
// by paul irish
// some (bad) code from this css color inverter
// http://plugins.jquery.com/project/invert-color
// some better code via Opera to inverse images via canvas
// http://dev.opera.com/articles/view/html-5-canvas-the-basics/#insertingimages
// and some imagesLoaded stuff from me
// http://gist.github.com/268257