Skip to content

Instantly share code, notes, and snippets.

View yukulele's full-sized avatar

Clément P yukulele

  • France
View GitHub Profile
function parseHtmlFragment(str = '') {
var t = document.createElement('template')
t.innerHTML = str
return t.content.cloneNode(true)
}
@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++ ){
<?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 / prettier.js
Created August 29, 2017 17:24
client side prettier
This file has been truncated, but you can view the full file.
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var asn1=exports;asn1.bignum=require("bn.js");asn1.define=require("./asn1/api").define;asn1.base=require("./asn1/base");asn1.constants=require("./asn1/constants");asn1.decoders=require("./asn1/decoders");asn1.encoders=require("./asn1/encoders")},{"./asn1/api":2,"./asn1/base":4,"./asn1/constants":8,"./asn1/decoders":10,"./asn1/encoders":13,"bn.js":17}],2:[function(require,module,exports){var asn1=require("../asn1");var inherits=require("inherits");var api=exports;api.define=function define(name,body){return new Entity(name,body)};function
This file has been truncated, but you can view the full file.
{"candidats":["M. Emmanuel MACRON","Mme Marine LE PEN","M. François FILLON","M. Jean-Luc MÉLENCHON","M. Benoît HAMON","M. Nicolas DUPONT-AIGNAN","M. Jean LASSALLE","M. Philippe POUTOU","M. François ASSELINEAU","Mme Nathalie ARTHAUD","M. Jacques CHEMINADE","Abstentions","Blancs","Nuls"],"candidatsID":{"M. Emmanuel MACRON":0,"Mme Marine LE PEN":1,"M. François FILLON":2,"M. Jean-Luc MÉLENCHON":3,"M. Benoît HAMON":4,"M. Nicolas DUPONT-AIGNAN":5,"M. Jean LASSALLE":6,"M. Philippe POUTOU":7,"M. François ASSELINEAU":8,"Mme Nathalie ARTHAUD":9,"M. Jacques CHEMINADE":10,"Abstentions":11,"Blancs":12,"Nuls":13},"villes":[["01","Ambléon",[15,18,14,19,3,4,1,2,0,1,0,20,2,0]],["01","Ambronay",[348,458,233,296,82,80,13,17,11,9,1,268,53,11]],["01","Ambutrix",[95,135,84,89,23,28,3,8,2,3,3,91,12,5]],["01","Ambérieu-en-Bugey",[1332,1667,1084,1412,344,346,60,91,71,40,5,1962,114,58]],["01","Ambérieux-en-Dombes",[191,306,197,126,37,45,6,10,10,5,0,215,21,3]],["01","Andert-et-Condon",[55,40,44,39,8,6,8,3,6,0,0,41,1,3]],["01","Anglefor
@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;
@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);
@yukulele
yukulele / dabblet.css
Created April 11, 2013 12:49
Untitled
/*matrix transform 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);