Skip to content

Instantly share code, notes, and snippets.

@ryanseddon
ryanseddon / html5-airplay
Created January 12, 2011 23:01
Add airplay attribute to HTML5 video containers
(function(doc){
if("querySelectorAll" in doc) {
var vids = doc.querySelectorAll("video"),
len = vids.length,
cvid;
while(len--) {
cvid = vids[len];
if("setAttribute" in cvid) {
@ryanseddon
ryanseddon / fontface.css
Created February 6, 2011 23:37
The many faces of font face
// Just a bit of fun, http://www.thecssninja.com/demo/css_fontface/
// Happy face
@font-face {
font-family:InYourFace;
src: url('Ubuntu-B.eot?') format('☺'),
url('Ubuntu-B.woff') format('woff'),
url('Ubuntu-B.ttf') format('truetype'),
url('Ubuntu-B.svg#webfontssbCkuz5') format('svg');
}
/**
* Provides requestAnimationFrame in a cross browser way.
* @author paulirish / http://paulirish.com/
*/
if ( !window.requestAnimationFrame ) {
var pollFocus;
window.requestAnimationFrame = ( function() {
return window.webkitRequestAnimationFrame ||
@ryanseddon
ryanseddon / css3gencon.js
Created April 24, 2011 00:51
Modernizr CSS3 Generated Content test
// Using the new exposed styleElem method we can hook into the internal DOM injection code that modernizr uses.
// This make doings tests like this easy!
// Opera is currently the only browser to support CSS3 generated content, which will replace all the elements content
// with the content properties value.
Modernizr.addTest('css3generatedcontent', function () {
var bool;
Modernizr.testStyles("#modernizr { content:':)' }",function(node){
@ryanseddon
ryanseddon / testStyle.js
Created May 20, 2011 05:44
Get computed styles
testStyle = function( prop, value ) {
return injectElementWithStyles('#modernizr { '+prop+': '+value+' }',function(elem){
return (window.getComputedStyle ?
getComputedStyle(elem, null) :
elem.currentStyle)[prop] == value;
});
}
@ryanseddon
ryanseddon / marquee.js
Created May 25, 2011 07:07
Marqeeeeeeeeeeeeeeeeeeeeeeee
// Because the world needs more marquee's
if(!''.marquee) {
String.prototype.marquee = function() {
return '<marquee>' + this + '</marquee>';
}
}
"OMG".marquee();
@ryanseddon
ryanseddon / LICENSE.txt
Created June 6, 2011 04:51 — forked from 140bytes/LICENSE.txt
select DOM elements by any valid CSS selector
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ryanseddon
ryanseddon / NanoMCE.html
Created June 24, 2011 05:39
Worlds smallest WYSIWYG with live preview
<!-- Paste it in your address bar -->
data:text/html,<pre onkeyup="(function(d,t){d[t]('iframe')[0].contentDocument.body.innerHTML = d[t]('pre')[0].textContent;})(document,'getElementsByTagName')" style="width:100%;height:48%;white-space:pre-wrap;overflow:auto;" contenteditable></pre><iframe style="width:100%;height:48%">
@ryanseddon
ryanseddon / gist:1464972
Created December 12, 2011 04:45
Extending modernizr core tests without changing the core
if(Modernizr.postmessage) {
// So we can extend it but still do `if(Modernizr.postmessage)`
Modernizr.postmessage = new Boolean(true);
Modernizr.postmessage.extend = function() {
// Do some tests
return bool;
}
}
/**
* That's allota prefixes - http://lea.verou.me/css3patterns/#stars
*/
background:
-moz-linear-gradient(126deg, #232927 4%, transparent 4%) -70px 43px,
-moz-linear-gradient( 54deg, #232927 4%, transparent 4%) 30px 43px,
-moz-linear-gradient( 18deg, #e3d7bf 8.5%, transparent 8.5%) 30px 43px,
-moz-linear-gradient(162deg, #e3d7bf 8.5%, transparent 8.5%) -70px 43px,
-moz-linear-gradient(234deg, #e3d7bf 7.5%, transparent 7.5%) -70px 23px,