Skip to content

Instantly share code, notes, and snippets.

View yukulele's full-sized avatar

Clément P yukulele

  • France
View GitHub Profile
<?php
function ieClasses( $min = 6, $max = 11 ) {
$classes = array();
preg_match("/msie (\d+)/i", $_SERVER['HTTP_USER_AGENT'], $match);
if( count( $match ) > 0 ){
$version = +$match[1];
$classes[] = 'ie';
$classes[] = 'ie' . $version;
for( $i = $min ; $i <= $max ; $i++ ){
if( $version < $i )
@yukulele
yukulele / ie-version.js
Last active January 9, 2018 13:45
Test Internet Explorer version and add classes to <html>
var ieVersion = (function(){
var classes = []
var match = /msie (\d+)/i.exec( navigator.userAgent )
if( match ){
var version = +match[1]
var min = 6
var max = 11
classes.push( 'ie' )
classes.push( 'ie' + version )
for( var i = min ; i <= max ; i++ ){
@yukulele
yukulele / scroobar-width.js
Last active August 29, 2015 13:57
scrollbar width
var scrollBarWidth = (function(){
var html = document.documentElement;
var outer = document.createElement("div");
var inner = document.createElement("div");
outer.style.visibility = "hidden";
outer.style.width = "100px";
outer.style.overflow = "scroll";
outer.appendChild(inner);
@yukulele
yukulele / dabblet.css
Created February 4, 2014 16:20 — forked from LeaVerou/dabblet.css
urlencoded SVG checkerboard
/**
* urlencoded SVG checkerboard
*/
html{
min-height: 300px;
background: tan center url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="%2358a"><rect x="50" width="50" height="50" /><rect y="50" width="50" height="50" /></svg>');
background-size: 20px;
transition:2s all;
}
@yukulele
yukulele / jquery.wordify.js
Created January 28, 2014 14:49
wrap each word in a span
$.fn.wordify = function(){
this.find(":not(iframe,textarea)").addBack().contents().filter(function() {
return this.nodeType === 3;
}).each(function() {
var textnode = $(this);
var text = textnode.text();
text = text.replace(/([^\s-.,;:!?()[\]{}<>"]+)/g,'<span>$1</span>');
textnode.replaceWith(text);
});
return this;
@yukulele
yukulele / jquery.removeinlinecss.js
Created January 17, 2014 14:16
jQuery Inline CSS remover
jQuery.fn.removeInlineCss = function(property){
if(property == null)
return this.removeAttr('style');
var proporties = property.split(/\s+/);
return this.each(function(){
var remover =
this.style.removeProperty // modern browsers
@yukulele
yukulele / dabblet.css
Created January 11, 2014 11:36 — forked from LeaVerou/dabblet.css
(C)Leanest CSS spinner ever
/**
* (C)Leanest CSS spinner ever
*/
@keyframes spin {
to { transform: rotate(1turn); }
}
.progress {
position: relative;
@yukulele
yukulele / dabblet.css
Created June 5, 2013 14:42
Psuedo element test on <img>
/*
Psuedo element test on <img>
*/
h1:after{
content:"h1 after";
color:pink;
}
h1:before{
content:"h1 before";
color:blue;
// if Navigation Timing is not supported, fallback to Date.naw() called on start (sufficient in many cases)
// Date.now is also polyfilled
(function(p){
if(!Date.now)
Date.now = function(){return +new Date};
if (!p.now){
var start = (p.timing && p.timing.navigationStart) || Date.now();
p.now = function now(){
return Date.now() - start;
@yukulele
yukulele / dabblet.css
Created April 11, 2013 14:06
Untitled
/*matrix experiments*/
div{
width:200px;
height:200px;
margin:50px;
background:grey;
transition:transform 1s ease;
border-top-right-radius:100px;
transform:matrix(1,0,0,1,0,0);