Skip to content

Instantly share code, notes, and snippets.

View louisremi's full-sized avatar

Louis-Rémi Babé louisremi

View GitHub Profile
@louisremi
louisremi / gulpfile.js
Created June 27, 2014 08:41
Heavy logic in gulp header
gulp.task('build-typeface', function() {
return merge(
gulp.src(paths.components)
.pipe(cached('components'))
// add tabulations to non-empty newlines
.pipe(replace(/(?:^|\r\n?|\n)(?![\r\n])/g, '\n\t\t\t'))
// replace points[X] with points(X)
.pipe(replace(/points\[(\d+)\]/g, 'points($1)'))
.pipe(jshint({
@louisremi
louisremi / pgf.YAML-tmLanguage
Created January 7, 2014 15:54
Prototypo Glyph Formula Highlighting
# [PackageDev] target_format: plist, ext: tmLanguage
---
name: Prototypo Glyph Formula
scopeName: source.prototypo_glyph_formula
fileTypes: [pgf, pcf]
uuid: e87ec56d-d1cc-417c-98df-6507c710898f
patterns:
- include: '#line-comment'
@louisremi
louisremi / LICENSE.txt
Created June 1, 2012 11:50 — forked from 140bytes/LICENSE.txt
matches, check if an element matches a CSS selector | IE8 compatible
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Louis-Remi <http://louisremi.com>
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
@louisremi
louisremi / matchesSelector.js
Created May 31, 2012 20:46
snippets for matchesSelector article
(function(window,document,indexOf) {
var _atchesSelector = "atchesSelector",
html = document.documentElement,
prefixes = [
"webkitM",
"mozM",
"msM",
"oM",
"m"
@louisremi
louisremi / snippet1.html
Created May 21, 2012 13:45
snippets for article about Activable
<ul>
<li><a class="label active" href="#content1">label 1</a></li>
<li><a class="label" href="#content2">label 2</a></li>
<li><a class="label" href="#content3">label 3</a></li>
</ul>
<div id="content1" class="content active">Some content for label 1</div>
<div id="content2" class="content">Some content for label 2</div>
<div id="content3" class="content">Some content for label 3</div>
@louisremi
louisremi / LICENSE.txt
Created October 30, 2011 22:45 — forked from 140bytes/LICENSE.txt
popstate, polyfill that executes window.onpopstate callback whenever location.hash changes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 @louis_remi <http://louisremi.com>
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
@louisremi
louisremi / LICENSE.txt
Created October 27, 2011 09:12 — forked from 140bytes/LICENSE.txt
c, an expressive className manipulation lib: c( elem, 'has/add/remove/toggle', class_name )
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 @louis_remi <http://louisremi.com>
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
@louisremi
louisremi / appcacheReload.js
Created October 6, 2011 09:35
appcache reload
(function( w, d ) {
// feature detection
if ( w.applicationCache ) {
// this script shouldn't run on first load
if ( localStorage.hasAppcache === "true" ) {
// display a loader and block interaction if an update is available
applicationCache.addEventListener("downloading", function() {
@louisremi
louisremi / insertAdjacentHTML.js
Created August 18, 2011 16:29
insertAdjacentHTML API
// HTML inserted before elem in the DOM
elem.insertAdjacentHTML( "beforebegin", ... )
// inside elem, before its first child
elem.insertAdjacentHTML( "afterbegin", ... )
// inside elem, after its last child
elem.insertAdjacentHTML( "beforeend", ... )
// HTML inserted after elem in the DOM
elem.insertAdjacentHTML( "afterend", ... )
@louisremi
louisremi / firefoxTouch.js
Created August 9, 2011 13:48
Minimalist touch event example
canvas.addEventListener("touchmove", function( event ) {
event.preventDefault();
// Touch events include all fingers moving on the surface
var touches = event.changedTouches,
i = touches.length;
// Touches can be iterated like an array
while ( i-- ) {
canvasCtx.beginPath();
canvasCtx.arc(