Navigation Menu

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 / stupid-memoize.js
Last active May 14, 2016 15:20
stupid memoize
function memoize(fn) {
var cache = {};
// return a memoized version of the function
return function(arg) {
// intercept the argument
if ( !(arg in cache) ) {
// if it's not in cache, execute the original function and
// cache the result, using the argument as the cache key.
cache[arg] = fn.call(this, arg);
const gulp = require('gulp');
const shelter = require('gulp-shelter')(gulp);
const BRANCH = process.env.TRAVIS_BRANCH;
// project config
const project = 'projectName';
const main = `src/main.js`;
const dest = `dist/${project}.js`;
const domain = (
BRANCH === 'master' ? 'www.domain.com' :
"name": "fooproject",
"config": {
"reporter": "xunit"
},
"scripts": {
"test": "mocha test/ --reporter $npm_package_config_reporter",
"test:dev": "npm run test --fooproject:reporter=spec"
}
"devDependencies": {
"eslint": "latest",
"node-sass": "latest",
"browserify": "latest"
},
"scripts": {
"lint": "eslint **",
"build:css": "node-sass src/ -o dist/",
"build:js": "browserify src/main.js > dist/main.js",
"build": "npm run lint && npm run build:css && npm run build:js"
@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
@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;
<!DOCTYPE html>
<html>
<!--
<== The code that creates the glyph is in script.js
-->
<head>
<meta charset="utf-8" />
<link href="//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css" rel="stylesheet" />
textarea {
width: 100%;
height: 300px;
margin: 0;
padding: 20px;
border: 0;
border-radius: 0;
@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 / genes_export.svg
Created November 10, 2014 18:13
SVG font exported by Prototypo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.