Skip to content

Instantly share code, notes, and snippets.

// quick test for box-shadow support of inset and spread radius
// and datauri test
// boxshadow test needs other prefixes added.
var docElem = document.documentElement;
// if WebkitBoxShadow is supported at all then:
if (docElem.style.WebkitBoxShadow !== undefined) { /* basic support */ }
// feature test for position fixed.
Modernizr.addTest('positionfixed', function () {
var test = document.createElement('div'),
control = test.cloneNode(false),
fake = false,
root = document.body || (function () {
fake = true;
return document.documentElement.appendChild(document.createElement('body'));
}());
@paulirish
paulirish / gist:598008
Created September 26, 2010 15:12
Modernizr lite - broken and deprecated. SEE COMMENT
// Modernizr lite, unofficial. ;)
// usage:
//
// testStyle('box-shadow')
//
// a class of `boxshadow` or `no-boxshadow` is added to the <html> element accordingly.
function testStyle(style){
@paulirish
paulirish / gist:601751
Created September 28, 2010 20:50
localStorage and sessionStorage should accept objects
// desire: localStorage and sessionStorage should accept objects
// in fact they do according to spec.
// http://code.google.com/p/chromium/issues/detail?id=43666
// but so far that part isnt implemented anywhere.
// so we duckpunch set/getItem() to stringify/parse on the way in/out
// this seems to work in chrome
// but fails in FF (cant redefine setItem as a function, it just tostring's it)
@paulirish
paulirish / gist:603681
Created September 29, 2010 22:25
html5 and friends - a bigass bulleted list of features

HTML5 and friends.

A bigass bulleted list of features.

I commonly need to get a big list of all the stuff people think of when they think new and shiny these days. This list is for that.

I take a very inclusionist approach to it. 1

javascript APIs

  • Web Storage (localStorage, sessionStorage)
  • Web SQL Database
@paulirish
paulirish / gist:616412
Created October 8, 2010 05:38
"iframe" sitedown fallback via <object>
<!-- so it turns out that the object tag can act like an iframe
but the cool thing is you can nest object tags inside eachother for a fallback path.
what this means is you can "objectframe" a site.. and if it fails.. (site down, offline, whatever).. it'll use the next one.
so you can objectframe the live site and fallback to a screenshot.
or something.
demo at : http://jsfiddle.net/paul/CY2FQ/1/
-->
@paulirish
paulirish / utmstrip.user.js
Last active September 17, 2024 11:03
userscript: Drop the UTM params from a URL when the page loads
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @version 1.2
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http*://*
// ==/UserScript==
// allow $('elem').css({ 'left' : '+=10px' });
// so you dont need to do:
// $('elem').animate({ 'left' : '+=10px' }, 0);
// by paul irish
// for ralph holzmann
// http://github.com/paulirish/lazyweb-requests/issues#issue/10
@paulirish
paulirish / gist:649992
Created October 27, 2010 21:04
store all twitter favorites in instapaper
$ = window.jQuery;
var html = '' +
' <form action="//www.instapaper.com/bookmarklet/post_v5" method="post" id="instapaper"> \
<input type="hidden" name="p" value=""/> \
<input type="hidden" name="b" id="b" value=""/> \
</form>';
@paulirish
paulirish / gist:704386
Created November 17, 2010 23:55
10 or 11 or 12 things i learned from the jquery source
/*
.d dP"Yb dP"Yb 88""Yb .d .d dP"Yb 88""Yb .d oP"Yb. 888888 88 88 88 88b 88 dP""b8 .dP"Y8
.d88 dP Yb dP Yb 88__dP .d88 .d88 dP Yb 88__dP .d88 "' dP' 88 88 88 88 88Yb88 dP `" `Ybo."
88 Yb dP Yb dP 88"Yb 88 88 Yb dP 88"Yb 88 dP' 88 888888 88 88 Y88 Yb "88 o.`Y8b
88 YbodP YbodP 88 Yb 88 88 YbodP 88 Yb 88 .d8888 88 88 88 88 88 Y8 YboodP 8bodP'
88 88 888888 db 88""Yb 88b 88 888888 8888b. 888888 88""Yb dP"Yb 8b d8