Skip to content

Instantly share code, notes, and snippets.

// sorta like manual profiling.
// peek into your jquery method calls to see why they are being called so much
// usage:
// $.logCallsTo('append');
// $.logCallsTo('curCSS',true);
// output:
// http://gyazo.com/40cec25d875a7a767e95fd7a2f451b32.png
// http://jquery14.com/day-010/jquery-1-4-hawtness-4-with-paul-irish
/*d8b .d88888b. d888 d8888
Y8P d88P" "Y88b d8888 d8P888
888 888 888 d8P 888
8888 888 888 888 888 .d88b. 888d888 888 888 888 d8P 888
"888 888 888 888 888 d8P Y8b 888P" 888 888 888 d88 888
888 888 Y8b 888 888 888 88888888 888 888 888 888 8888888888
888 Y88b.Y8b88P Y88b 888 Y8b. 888 Y88b 888 888 d8b 888
// http://jquery14.com/day-12/jquery-1-4-hawtness-5-with-paul-irish
/*d8b .d88888b. d888 d8888
Y8P d88P" "Y88b d8888 d8P888
888 888 888 d8P 888
8888 888 888 888 888 .d88b. 888d888 888 888 888 d8P 888
"888 888 888 888 888 d8P Y8b 888P" 888 888 888 d88 888
888 888 Y8b 888 888 888 88888888 888 888 888 888 8888888888
888 Y88b.Y8b88P Y88b 888 Y8b. 888 Y88b 888 888 d8b 888
// 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!)
// uniqueifying strings
arr = 'group1,group2,group1,group4'.split(',');
$.map(arr, function(v,i){ return $.inArray(v,arr)!=i ? null : v });
// w regex
'group1,group2,group1,group4'.replace(/((^|,)([^,]+).*),\3(?=,|$)/g, '$1')
/by temp01
(function (undefined) {
function detectMutation() {
mutationSupported = true;
this.removeEventListener('DOMAttrModified', detectMutation, false);
}
var forEach = [].forEach,
regex = /^data-(.+)/,
el = document.createElement('div'),
mutationSupported = false,
// jQuery.support.(displayTable|displayTableCell|margin0auto|positionFixed)
// jQuery.support.displayTable and displayTableCell -
// to determine browser support for setting elements to that css display value
$.each(['','-cell'],function(k,v){
$.support['displayTable'+v.replace('-c','C')] = (function(){
var elem = $('<div>',{
css : {
display: 'table'+v,
// 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);
});
@paulirish
paulirish / getTwitterHistory.py
Created May 12, 2010 21:15
archive all your tweets to xml or json
'''
getTwitterHistory.
mostly written by Simon Willison (ithink?) and fucked with by paul irish
1. set the credentials correctly below
2. run: python gethistory.py
'''
import urllib2
// fixing The Mysterious Firefox setTimeout "Lateness" argument™
// by paul irish
// detail: http://benalman.com/news/2009/07/the-mysterious-firefox-settime/
// "feature" test
void setTimeout(function(){
if (arguments.length==1){ // bad mozilla!, bad!