Skip to content

Instantly share code, notes, and snippets.

View evaisse's full-sized avatar

Emmanuel Vaïsse evaisse

  • none
  • Nancy, France
View GitHub Profile
var fs = require('fs');
var path = require("path");
var gulp = require('gulp');
var browserify = require('browserify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var source = require('vinyl-source-stream');
var browserSync = require('browser-sync');
var changed = require('gulp-changed');
var gulp = require('gulp');
@evaisse
evaisse / angular-seed-gulpfile.js
Last active April 19, 2017 11:26
An Angular-seed tailored gulpfile, with ng-annotate, template pre-compile, html/css/js min, sourcemaps for css & js, revision & cache busting.
/**
* @author Emmanuel VAÏSSE <evaisse@gmail.com>
* @see https://gist.github.com/evaisse/2c9feac19496928ad1fd62459cff8122
*
* An Angular-seed (https://github.com/angular/angular-seed) tailored gulpfile, provide :
*
* - ng-annotate, prevengt loosing angular injection $annotation syntax against minification
* - angular template pre-compile
* - html/css/js minification
* - sourcemaps for css & js
@evaisse
evaisse / hash2xml.php
Last active September 28, 2016 10:49
Hash / Object / Array to XML using XmlWriter
<?php
/**
* User: evaisse
* Date: 28/09/2016
* Time: 12:45
*/
/**
* @see https://dev.kafol.net/2008/09/php-xml-generator.html
* Usage :
/*
*/
var fs = require('fs');
var results = {};
var frameworks = [
"vanillajs",
// "ractive",
// "vue",
@evaisse
evaisse / install_mongo.sh
Last active June 18, 2016 17:15
Install mongodb 3.2 on ubuntu with remote authentication
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
# https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu-14.04/
# https://www.nonamehosts.com/blog/how-to-install-and-configure-mongodb-on-ubuntu-14-04-x64/
apt-get -y update
apt-get -y install curl fail2ban build-essential unzip whois zsh moreutils host gcc git libmcrypt4 libpcre3-dev g++ make make python-pip supervisor ufw unattended-upgrades default-mta
apt-get -y upgrade
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
@evaisse
evaisse / ngx_pagespeed.sh
Last active February 9, 2018 15:26
ngx_pagespeed
NPS_VERSION=1.10.33.6
NGINX_VERSION=1.9.12
# update
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip git
# Next, we have to satisfy all the dependencies needed to run Nginx. For this purpose run the command:
sudo apt-get build-dep nginx
@evaisse
evaisse / uuidv4.php
Last active March 2, 2016 14:08
A simple PHP snippet to generate UUIDv4 syntax compliant string for a given PHP request or process.
<?php
/**
* Use PHP >= 5.3, replace any chars that don't seems relevant
*/
strtoupper(sprintf("%.8s-%.4s-4%.3s-A%.3s-%.12s",
md5(uniqid()),
md5(gethostname()),
md5(getmypid()),
md5(php_sapi_name()),
@evaisse
evaisse / poll2build.sh
Last active August 29, 2015 14:25
poll2build.sh
#!/bin/sh
# lockfile for script
LOCKFILE=/var/lock/poll2build.pid
# check lock file
[ -f $LOCKFILE ] && echo "script already running @ `cat /var/lock/poll2build.pid`" && exit 0;
# trap for cleanup lock file
trap "{ rm -f $LOCKFILE; exit 255; }" EXIT INT
@evaisse
evaisse / gist:302b21637957a64155d5
Last active August 29, 2015 14:22
fatal with to without trace ?
<?php
function will_fatal()
{
a();
}
function a()
{
@evaisse
evaisse / object.toquerystring.js
Last active October 19, 2017 00:09
Object.toQueryString - Vanilla JS version - encode object to POST, GET AJAX calls
/**
* Simply encode a base js object as {a:2, d:[1,"two"], c: {foo: {bar:1}}}
* And returns URL encoded string : a=2&d[0]=1&d[1]=two&c[foo][bar]=1"
*
* @param {Object} object A base javascript object : {}
* @param {String} base Optionnal base notation, should only be used by recursion for internal work
* @return {String} URL encoded query string
*/
Object.toQueryString = function (object, base) {
var queryString = [];