This file contains 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
// find all elements with a z-index and indicate what they are. | |
// uses css outline which is not supported in IE <8 | |
function contrast(color){ return '#' + | |
(Number('0x'+color.substr(1)).toString(10) > 0xffffff/2 ? '000000' : 'ffffff'); | |
} | |
jQuery('*') | |
.filter(function(){ return $(this).css('zIndex') !== 'auto'; }) | |
.each(function(){ |
This file contains 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
// css() upgrade for a few shorthand values | |
// paul irish. MIT license. | |
// by default you can't do $(elem).css('margin'), but instead $(elem).css('marginTop') and so on. | |
// this monkeypatch allows lets you retrieve all four values in shorthand style: | |
// e.g. $(this).css('padding') | |
(function($){ | |
var css = $.fn.css, methods = {'padding':1,'margin':1}, dirs = 'Top Right Bottom Left'.split(' '); |
This file contains 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
"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. |
This file contains 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
// sharethis plugin by paul irish | |
// usage: | |
// $('a.sharethistrigger').shareThis(); | |
// for ShareThis | |
$.fn.shareThis = function(){ | |
if (!$(this).length) return this; // quit if theres nothing. | |
// this path should come out of the configurator |
This file contains 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
// easy refresh-css keybinding to alt-w | |
// alt-r was taken in IE, so consider this a CSS Weefresh | |
// original code from http://paulirish.com/2008/how-to-iterate-quickly-when-debugging-css/ | |
$(document).keyup(function(e){ | |
if ( e.which == 87 && e.altKey){ | |
var h,a,f;a=document.getElementsByTagName('link');for(h=0;h<a.length;h++){f=a[h];if(f.rel.toLowerCase().match(/stylesheet/)&&f.href){var g=f.href.replace(/(&|\?)forceReload=\d+/,'');f.href=g+(g.match(/\?/)?'&':'?')+'forceReload='+(new Date().valueOf())}} | |
} |
This file contains 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 to12Hr = function(n, r /* round to nearest r minutes */) { | |
if (!n || n >= 24) return '12:00 AM'; | |
var m = (Math.round(n%1*(r = (r ? 60/r : 60)))/r)*60; | |
return ((n = (m>59 ? n+1 : n))>=13 ? (n|0)-12 : n|0) + ':' + (m>9 ? (m>59 ? '00' : m) : '0'+m) + (n>=12 && m<60 ? ' PM' : ' AM'); | |
} | |
// to12Hr(6.5) => "6:30 AM" | |
// to12Hr(13.19) => "1:11 PM" | |
// to12Hr(13.19, 15) => "1:15 PM" (rounds to 15 mins) |
This file contains 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
// A bookmarklet to add search ability to any github.com repo. | |
// Note: Disable Chrome Frame in IE to use this bookmarklet as github.com supports Chrome Frame | |
// @author John-David Dalton (http://www.twitter.com/jdalton) | |
javascript:void(function(){var a='';if(!$('.subnav-bar').length){a=$('form#search-form input[name=q]').val();$('.big-search').remove();$('.tabs').after('<div class="subnav-bar"></div>')}else{$('#repo-search-form').remove()}$('.subnav-bar').append('<ul style="float:right;margin-left:10px;"><li><a class="dropdown" href="#">Search by…</a><ul><li><a href="#" onclick="$(\'#choice\').val(\'code\');return false;">Code</a></li><li><a href="#" onclick="$(\'#choice\').val(\'grep\');return false;">Commit Messages</a></li><li><a href="#" onclick="$(\'#choice\').val(\'author\');return false;">Author</a></li><li><a href="#" onclick="$(\'#choice\').val(\'committer\');return false;">Committer</a></li></ul></li></ul><form id="repo-search-form" action="'+$('.pagehead.repohead h1 a')[1].href+'/search"><i |
This file contains 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
<!DOCTYPE html> | |
<html class="no-js"> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" /> | |
<link rel="stylesheet" href="http://www.eyecon.ro/colorpicker/css/colorpicker.css" type="text/css" /> | |
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script> |
This file contains 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
// | |
// Replicates .activate() from the Prototype JS library. | |
// http://www.prototypejs.org/api/form/element/activate | |
// | |
jQuery.fn.activate = function() { | |
if ('focus' in this) this.focus(); | |
if ('select' in this && (this.tagName != 'INPUT' || !(/^(?:button|reset|submit)$/i.test(this.type)))) { | |
this.select(); |
OlderNewer