Skip to content

Instantly share code, notes, and snippets.

View nielk's full-sized avatar
🦊

Alexandre Oger nielk

🦊
View GitHub Profile
@nielk
nielk / .eslintrc
Created June 9, 2015 13:20
.eslintrc
{
"rules": {
"indent": [
2,
4
],
"quotes": [
2,
"single"
],
@nielk
nielk / gulpfile.js
Last active August 29, 2015 14:15
gulpfile.js
var gulp = require('gulp');
var browserSync = require('browser-sync');
var uglify = require('gulp-uglify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var watchify = require('watchify');
var reactify = require('reactify');
var reload = browserSync.reload;
var sourcemaps = require('gulp-sourcemaps');
@nielk
nielk / setup.sh
Last active October 9, 2015 22:54
setup.sh
echo 'Installing terminal stuffs'
echo 'show hidden files'
defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
if [ -x /usr/local/bin/brew ]; then
echo 'Brew'
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
@nielk
nielk / cache.md
Created January 30, 2015 08:00
avoid cache

var source = source + '?cache=' + new Date().getTime(); // avoid cache

@nielk
nielk / make.vim
Created January 27, 2015 20:34
launch make at save in vim
:autocmd BufWritePost <buffer> make
@nielk
nielk / levenshtein.md
Created January 25, 2015 11:26
levenshtein.algo

Javascript implementation of levenshtein distance.

function levenshtein(a,b) {
  var matrix = [];
  var cost = 0;
 
  // cols 1,2,...,n-1,n
  for(var i = 0; i <= b.length; i++) {
 matrix[i] = [i];
@nielk
nielk / merge-sort.md
Created January 25, 2015 11:19
merge-sort.algo

/!\ for training purpose, work in progress ...

javascript implementation :

input: even length and fist half et second half sorted (ex: [1,2,4,8,3,5,6,9])

var merge = function(d) {
  var c = new Array(d.length+1).join('0').split('').map(parseFloat);
 var a = d.slice(0, d.length/2);
@nielk
nielk / node-apache.md
Last active August 29, 2015 14:13
nodejs proxy pass apache

setup virtual host

<VirtualHost *:80>
    ServerName formations.preprod.lespolypodes.com
    DocumentRoot /var/www/preprod/polypodes-formations
    #php_value auto_prepend_file "/var/www/preprod/document_root.php"

    ProxyRequests off
@nielk
nielk / regex-tel.js
Created January 12, 2015 14:30
regex tel telephone validation
/^((\+|00)33\s?|0)[1-9](\s?\d{2}){4}$/g
// 0241784541
// 06 45 12 14 52
// +33228011588