Skip to content

Instantly share code, notes, and snippets.

Clément P yukulele

  • France
Block or report user

Report or block yukulele

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View esdown.js
/*=esdown=*/(function(fn, deps, name) { function obj() { return {} } if (typeof exports !== 'undefined') fn(require, exports, module); else if (typeof define === 'function' && define.amd) define(['require', 'exports', 'module'].concat(deps), fn); else if (typeof window !== 'undefined' && name) fn(obj, window[name] = {}, {}); else if (typeof self !== 'undefined' && name) fn(obj, self[name] = {}, {}); else fn(obj, {}, {}); })(function(require, exports, module) { 'use strict'; function __load(p, l) { module.__es6 = !l; var e = require(p); if (e && e.constructor !== Object) e.default = e; return e; }
(function() {
var VERSION = "0.9.9";
var Global = (function() {
try { return global.global } catch (x) {}
try { return self.self } catch (x) {}
return null;
@yukulele
yukulele / dabblet.css
Last active Oct 9, 2018
css transform make text-ugly (depending os/browser)
View dabblet.css
/**
* css transform make text-ugly (depending os/browser)
*/
div{
border:1px solid red;
padding:15px;
margin:50px;
font-size:17px;
transform-origin:0 0;
transform:rotate(10.4deg);
View dabblet.css
h1 {color: #345; text-shadow: 1px 1px 2px #aaa; font-size:1.8em}
h2 {color: #567; text-shadow: 1px 1px 2px #aaa; font-size:1.1em}
h3 {margin-bottom: 0; color: #678; text-shadow: 1px 1px 2px #aaa; font-size:1em}
#sizer{
resize:horizontal;
max-width:800px;
background:#ccc;
padding:40px;
border-radius:20px;
overflow:hidden;
View performance.now()-polyfill.js
// 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;
View parse-html-fragment.js
function parseHtmlFragment(str = '') {
var t = document.createElement('template')
t.innerHTML = str
return t.content.cloneNode(true)
}
@yukulele
yukulele / easing.ts
Last active Apr 22, 2018
Simple Easing Functions in Typescript
View easing.ts
class Ease {
static in(t: number, p = 1) {
return t ** p
}
static out(t: number, p = 1) {
return 1 - Ease.in(1 - t, p)
}
static inOut(t: number, p = 1):number {
if (t <= 0.5) {
return Ease.in(t * 2, p) / 2
@yukulele
yukulele / jquery.wordify.js
Created Jan 28, 2014
wrap each word in a span
View jquery.wordify.js
$.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 / ie-version.js
Last active Jan 9, 2018
Test Internet Explorer version and add classes to <html>
View ie-version.js
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++ ){
View ie-classes.php
<?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 Aug 29, 2017
client side prettier
View prettier.js
This file has been truncated, but you can view the full file.
You can’t perform that action at this time.