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
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(); |
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
if (!navigator.geolocation) { | |
navigator.geolocation = (function (window) { | |
function getCurrentPosition(callback) { | |
// NOTE: for some reason, chaging the url is *allowed* with this service. Useful, but random | |
// source: http://www.maxmind.com/app/javascript_city | |
// The source is open source, as per: http://www.maxmind.com/app/api, but doesn't discuss specific license use. Hopefully it's just free to use - yay internet! | |
var geourl = 'http://j.maxmind.com/app/geoip.js_' + Math.random(), | |
iframe = document.createElement('iframe'), | |
doc, win; |
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
// original (http://html5shiv.googlecode.com/svn/trunk/html5.js) | |
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})() | |
// kangax version (29 characters less, yay!) | |
/*@cc_on(function(e,i){i=e.length;while(i--)document.createElement(e[i])})("abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','))@*/ | |
// jdalton version (was 5, now 41 characters less than kangax, yay!) |
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
//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) | |
function isIE(version, comparison) { | |
var cc = 'IE', | |
b = document.createElement('B'), |
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
(function (undefined) { | |
function detectMutation() { | |
mutationSupported = true; | |
this.removeEventListener('DOMAttrModified', detectMutation, false); | |
} | |
var forEach = [].forEach, | |
regex = /^data-(.+)/, | |
el = document.createElement('div'), | |
mutationSupported = false, |
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
// mousewheel normalization. | |
// taken from http://html5readiness.com/js/script.js - cheers paul! | |
$(document).bind('DOMMouseScroll mousewheel', function(e, delta) { | |
delta = delta || (e.detail && -e.detail/3) || (e.wheelDelta && e.wheelDelta/120); | |
}); | |
OlderNewer