Skip to content

Instantly share code, notes, and snippets.

View timothylhuillier's full-sized avatar

Tim_LHUILLIER timothylhuillier

View GitHub Profile
@timothylhuillier
timothylhuillier / gist:dd1f12f9a0afc2532f119c1e6aa50780
Created May 25, 2016 13:36 — forked from will83/gist:5920606
Fonction PHP permettant la conversion de Lambert93 à WGS84 (selon le fichier fourni par l'IGN).
<?php
function lambert93ToWgs84($x, $y){
$x = number_format($x, 10, '.', '');
$y = number_format($y, 10, '.', '');
$b6 = 6378137.0000;
$b7 = 298.257222101;
$b8 = 1/$b7;
$b9 = 2*$b8-$b8*$b8;
$b10 = sqrt($b9);
$b13 = 3.000000000;
@timothylhuillier
timothylhuillier / README.md
Created December 30, 2015 23:39
Secure Middleware for Laravel 5

I noticed that Laravel 5 doesn't have a secure (https) middleware since the removal of filters. So i have re-implemented it and shared the code in the hope that you find it useful.

Installation

  • Add Secure.php to your app\Http\Middleware directory.
  • Add the secure middleware to your route.

Notes

  • If you are using route annotations, don't forget to re-scan your routes using the php artisan route:scan command.
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });
// iMacro CheatSheet - Command Reference
// http://wiki.imacros.net/Command_Reference
// iMacros supports 3 types of variables:
// * The macro variables !VAR0 thru !VAR9. They can be used with the SET and ADD command inside a macro.
// * Built-in variables. They contain certain values set by iMacros.
// * User-defined variables. They are defined in-macro using the SET command.
<?php
// Les instances en temps normal
//////////////////////////////////////////////////////////////////////
// En PHP, quand on a une classe non-statique, il faut d'abord l'instancier
// en faisant `new MyClass`. On place cette instance dans une variable, ensuite
// on appelle les méthodes sur la variables, comme ceci :
$elastica = new Elastica\Client('123456789');
@timothylhuillier
timothylhuillier / container.php
Created August 2, 2013 01:48 — forked from Anahkiasen/container.php
explication de la dépendance IOC
<?php
// Si on passe les dépendances manuellement
class HTML
{
function __construct(URL $url)
{
$this->url = $url;
}
<?php
//////////////////////////////////////////////////////////////////////
//////////////////////// METHODOLOGIE SEPARÉE ////////////////////////
//////////////////////////////////////////////////////////////////////
// app/controllers/UsersController --------------------------------- /
class UsersController
{