Skip to content

Instantly share code, notes, and snippets.

View petitchevalroux's full-sized avatar

Patrick Poulain petitchevalroux

View GitHub Profile
@petitchevalroux
petitchevalroux / lock.sh
Last active June 7, 2016 09:12
lock running script
#!/bin/bash
lockdir='/tmp/my.lock'
if ! mkdir "${lockdir}" &>/dev/null ; then
echo "Lock failed - exit" >&2
exit 1
fi
rm -rf "${lockdir}"
@petitchevalroux
petitchevalroux / get-coverage.sh
Last active April 5, 2016 13:14
Node JS: Generate coverage report with istambul and mocha and open it in browser
TESTS_PATH="tests"; ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha $TESTS_PATH;open coverage/lcov-report/index.html;
@petitchevalroux
petitchevalroux / pre-commit
Last active September 5, 2015 09:20
pre-commit php hooks
#!/usr/bin/php
<?php
//Récupération des fichier modifiés par le commit
exec('git diff --name-only HEAD | grep -E \'(.php)$\'', $output);
$cmds = [
['cmd' => 'php-cs-fixer fix'],
['cmd' => 'php -l','return' => 0],
];
foreach ($output as $file) {
@petitchevalroux
petitchevalroux / Arangodb.php
Created August 24, 2015 12:15
Arangodb with ODM
<?php
namespace BenchmarkNosql\Libraries\Storage;
use triagens\ArangoDb\Connection;
use triagens\ArangoDb\ConnectionOptions;
use triagens\ArangoDb\UpdatePolicy;
use triagens\ArangoDb\Collection;
use triagens\ArangoDb\CollectionHandler;
use triagens\ArangoDb\DocumentHandler;