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 / gist:d3d584b33f3f515243ff
Last active August 29, 2015 14:09
Webdev environment for OSX
# D'après ce tutoriel : http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/
$ xcode-select --install
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install git
$ brew doctor
$ brew install node
@louisremi
louisremi / fiddle.css
Last active August 29, 2015 14:15
Advanced Plumin.js example, using binary path operations, try it at http://jsfiddle.net/gh/gist/library/pure/d05d597a69e6569a3875/
textarea {
width: 100%;
height: 300px;
margin: 0;
padding: 20px;
border: 0;
border-radius: 0;
@louisremi
louisremi / test
Created March 10, 2015 17:18
test
// through2 is a thin wrapper around node transform streams
var through = require('through2'),
gutil = require('gulp-util'),
esprima = require('esprima'),
escodegen = require('escodegen'),
estraverse = require('estraverse'),
_ = require('lodash'),
PluginError = gutil.PluginError;
// consts
// -----------------------------------------------------------------
// To be added to CmdUtils API
// -----------------------------------------------------------------
// ** {{{ CmdUtils.getUbiquity( ) }}} **
//
// Get a reference to Ubiquity. This is used by
// {{{ CmdUtils.closeUbiquity() }}} and {{{ CmdUtils.getCommandByName() }}}, but
// probably doesn't need to be used directly by command feeds.
Index: event.js
===================================================================
--- event.js (revision 6582)
+++ event.js (working copy)
@@ -7,7 +7,7 @@
// Bind an event to an element
// Original by Dean Edwards
- add: function( elem, types, handler, data ) {
+ add: function( elem, types, handler, data, noSpecial ) {
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Bubbling test</title>
<style>
.test li {
margin-left: 3em;
width: 200px;
}
var
abs = Math.abs,
sqrt = Math.sqrt,
floor = Math.floor,
min = Math.min,
V3 = function(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
// Minimalist class (className) manipulation library
var klass = {
has: function(elem, name) {
return (' '+elem.className+' ').indexOf(' '+name+' ') != -1;
},
add: function(elem, name) {
if(!klass.has(elem, name)) {
elem.className += ' '+name;
}
},
(function($) {
var div = document.createElement('div'),
divStyle = div.style,
support = $.support,
rmatrixFilter = /M\d{2}=([\d+.\-]+)/g;
support.transform =
divStyle.MozTransform === ''? 'MozTransform' :
(divStyle.WebkitTransform === ''? 'WebkitTransform' :