Skip to content

Instantly share code, notes, and snippets.

View FabienArcellier's full-sized avatar

Fabien Arcellier FabienArcellier

View GitHub Profile
// Check loading of Single Page Application
//
// It checks the count of requests equals the count of response
// of loading of SPA
var page = require('webpage').create();
var system = require('system');
var lastReceived = new Date().getTime();
var requestCount = 0;
@FabienArcellier
FabienArcellier / .htaccess
Created December 2, 2012 18:18
Disable indexaction or block access to a directory in htaccess file
# disable directory browsing
Options All -Indexes
# Deny access to this directory for anybody
Order allow,deny
Deny from all
@FabienArcellier
FabienArcellier / install_composer.sh
Created December 9, 2012 15:11
Install composer on linux machine
sudo curl -s https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin/
@FabienArcellier
FabienArcellier / index.php
Created December 9, 2012 15:51
Autoload namespace manually from silex
<?php
$loader = require_once __DIR__.'/vendor/autoload.php';
$loader -> add('Application', __DIR__); // PSR-0 autoloading, the directory '__DIR__/Application' must exists
$app = new Silex\Application();
$app->run();
?>
@FabienArcellier
FabienArcellier / disable_unc_check.reg
Created December 11, 2012 15:41
Disable Unc Check in register database
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"DisableUNCCheck"=dword:00000001
@FabienArcellier
FabienArcellier / famille.prolog
Created December 14, 2012 14:26
Family Link
/* Programme sur les liens familiaux */
pere(paul, jean).
pere(paul, frederic).
pere(emilie, marie).
pere(jean, andre).
pere(jean, cathy).
pere(jean, francis).
pere(frederic, marc).
pere(frederic, lisa).
@FabienArcellier
FabienArcellier / menu.prolog
Created December 14, 2012 15:39
Create menu with price and calories associate with it
entree(salade, 5, 400).
entree(taboulee, 3, 300).
plat(andouillette, 8, 500).
plat(steak, 10, 900).
fromage(bri, 3, 150).
fromage(camembert, 4, 300).
dessert(tarte, 5, 320).
@FabienArcellier
FabienArcellier / findcode.sh
Created November 13, 2015 14:18
findcode & display code command
function findcode {
extension=$1
pattern=$2
find . -name "*.${extension}" | xargs grep -ni --colour=always ${pattern}
}
# Utility
function displaycode {
file=$(echo $1 | cut -f1 -d:)
% list_contains(5, [1,2]) % Renvoie false
% list_contains(5, [1,5]) % Renvoie true
list_contains(X, [X|_]).
list_contains(X, [_|R]):- list_contains(X, R).
@FabienArcellier
FabienArcellier / fibonacci.prolog
Created December 20, 2012 15:10
Calculate fibonacci suite
fibo(1, Result):- Result is 1.
fibo(2, Result):- Result is 1.
fibo(X, Result):- X > 2, X1 is X - 1, X2 is X - 2, fibo(X1, ResultN1), fibo(X2, ResultN2), Result is ResultN1 + ResultN2.