Skip to content

Instantly share code, notes, and snippets.

View nicolasrenon's full-sized avatar

Nicolas Renon nicolasrenon

View GitHub Profile
@nicolasrenon
nicolasrenon / index.html
Last active December 30, 2016 15:14
Example of FormData
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>Example of FormData</title>
</head>
<body>
<form name="subscription">
<p><input type="text" name="first_name" placeholder="First name"></p>
<p><input type="text" name="last_name" placeholder="Last name"></p>
@nicolasrenon
nicolasrenon / dom-selector.js
Last active November 13, 2016 19:35
DOM selector
export function dom(selector, context) {
let nodes = (context || document).querySelectorAll(selector);
return (nodes.length === 1) ? nodes[0] : Array.prototype.slice.call(nodes);
}
@nicolasrenon
nicolasrenon / Carousel.js
Created April 1, 2015 15:11
Carousel with touch support
@nicolasrenon
nicolasrenon / resetFieldset.css
Last active July 26, 2022 08:08
Reset fieldset and legend styles
/* From http://thatemil.com/blog/2015/01/03/reset-your-fieldset/ by Emil Björklund */
legend {
display: table;
padding: 0;
}
fieldset {
border: 0;
margin: 0;
min-width: 0;
@nicolasrenon
nicolasrenon / blocklink.js
Last active August 29, 2015 14:11
BlockLink
@nicolasrenon
nicolasrenon / doughnut.html
Last active August 29, 2015 14:09
Doughnut (need improvement)
<div class="Doughnut js-doughnut" data-percent="55">
<div class="Doughnut-slice">
<span class="Doughnut-pie"></span>
</div>
</div>
@nicolasrenon
nicolasrenon / placeholder.js
Last active August 29, 2015 14:09
Fallback to handle placeholder for IE 9 and below
(function () {
'use strict';
var Placeholder = function (element) {
this.field = element;
this.password = (this.field.attr('type') === 'password');
this.placeholder = this.field.attr('placeholder');
this.init();
};
@nicolasrenon
nicolasrenon / u-verticalAlign.scss
Last active August 29, 2015 14:06
Vertical align without table property
.u-verticalAlign {
&:before {
content: '';
display: inline-block;
height: 100%;
margin-right: -0.25em;
vertical-align: middle;
}
}
.u-verticalAlign-content {
@nicolasrenon
nicolasrenon / video.html
Created August 11, 2014 09:24
Basic HTML5 video markup
<video poster="poster.jpg" controls>
<source type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"' src="video.mp4">
<source type='video/webm; codecs="vp8.0, vorbis"' src="video.webm">
</video>
@nicolasrenon
nicolasrenon / validate-email.js
Last active November 13, 2016 19:40
Email validation
export function validateEmailAddress(email) {
let regexEmailPattern = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/igm;
return regexEmailPattern.test(email);
}