Skip to content

Instantly share code, notes, and snippets.

Avatar

Emmanuel Vaïsse evaisse

  • none
  • Nancy, France
View GitHub Profile
@evaisse
evaisse / read_dotenv.php
Last active Aug 11, 2020
A simple dotenv (.env) file parsing function to avoid dependencies
View read_dotenv.php
<?php
function read_dotenv(string $filePath) {
$envs = parse_ini_file($filePath);
foreach ($envs as $k => $v) {
$k = strtoupper($k);
putenv("$k=$v");
$_ENV[$k] = $_SERVER[$k] = $v;
}
@evaisse
evaisse / Pagination.js
Created Jul 29, 2020
A simple pagination class
View Pagination.js
/**
var pagination = new Pagination(itemPerPage, totalItemCount, currentPageNumber);
<ul class="pagination" ng-if="pagination">
<li ng-repeat="link in pagination.getLinks()"
ng-class="{active: link.active, disabled: link.disabled}">
<a ng-if="link.type === 'shortcut'" aria-label="{{link.label}}" ng-click="updateSearchParams({ page: link.page })">
<span aria-hidden="true">{{link.label}}</span>
@evaisse
evaisse / slugify.rb
Last active Jun 30, 2020
Ruby Slugify
View slugify.rb
def slugify str
str.ljust(100)
.gsub(/[\W\s\t\r\n\f]/, ' ')
.strip
.gsub(/\s\s+/, '')
.gsub(' ', '_')
.gsub(/\W/,'')
.gsub('_', '-')
.downcase
end
View mail.md

Bonjour à vous.

Pour sa sixième édition, le festival de micro-édition au doux nom de L'ENFER ouvrira ses portes le week-end du 11 au 13 septembre 2019, à Nancy. Nous serions heureux de vous compter parmi les exposants de notre salon!

Nous vous invitons à prendre connaissance de l’événement via les informations suivantes:

SITES INTERNET

@evaisse
evaisse / ovh-create-site.sh
Last active Dec 2, 2019
OVH create site & deploy via GIT
View ovh-create-site.sh
#!/bin/sh
# Simple script create a site associated with a
if [ -z "$1" ]
then
echo "No argument supplied, you should do 'create-site.sh my.foo.com"
exit 1
fi
View session_handler_redirect.php
<?php
/**
*
*/
ob_start();
class EncryptedSessionHandler extends SessionHandler
{
@evaisse
evaisse / Dockerfile
Last active Mar 21, 2017
A Docker container to confirm the bug : https://bugs.php.net/bug.php?id=63426
View Dockerfile
FROM debian
RUN apt-get update && apt-get install -y libapache2-mod-php5 php5-xdebug nano vim
RUN a2enmod php5
RUN rm /var/www/html/index.html
COPY index.php /var/www/html/index.php
COPY test.php /var/www/html/test.php
ADD start.sh /root/start.sh
@evaisse
evaisse / gist:6e2b08a0d213f67b1d090a387df908c4
Created Feb 28, 2017
debian jessie varnish5 + mod page speed
View gist:6e2b08a0d213f67b1d090a387df908c4
echo "" >> /etc/apt/sources.list
echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
apt-get update
apt-get install -y \
build-essential apt-transport-https automake autotools-dev libedit-dev \
libjemalloc-dev libncurses-dev libpcre3-dev \
View ractive-watchify-gulpfile.js
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 Apr 19, 2017
An Angular-seed tailored gulpfile, with ng-annotate, template pre-compile, html/css/js min, sourcemaps for css & js, revision & cache busting.
View angular-seed-gulpfile.js
/**
* @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