Skip to content

Instantly share code, notes, and snippets.

Nouveau projet :

  • pour la boite : le projet appartient à la boite (c'est elle qui décide de la license)
  • perso : pas sur son temps de travail ;) (sauf si accord bien sur)

Si exception (par ex. la boite veut pas spécialement maintenir un projet) -> accord de la boite pour que tu bosse dessus et que le projet t'appartienne.

Contribution à un projet existant :

Toute contribution est soumise à la license du projet auquel on contribue. Donc si la boite est d'accord sur ce principe y'a pas de différence si c'est un projet perso ou 3rd party (Symfony, etc.).

@mnapoli
mnapoli / README.md
Last active August 29, 2015 14:23
Boot2docker on OS X

Boot2docker on OS X

Problems:

  • permissions
  • slow I/O because of vboxfs

Solution: mount the disk using NFS.

On OS X

<?php
return [
'doctrine.orm.configuration' => [
'driver' => 'pdo_mysql',
'user' => 'root',
'password' => '',
'dbname' => get('doctrine.orm.db_name'),
],
@mnapoli
mnapoli / README.md
Last active December 8, 2016 14:42
Extended callables

PHP callables

Those are callables recognized by PHP natively. They can be invoked simply: $callable(...).

  • Closures: function () { ... }

  • Static method call: ['A', 'staticMethod'] or also Foo::staticMethod

    class A {

public static function staticMethod() { ... }

<?php
namespace TwigModule;
use Interop\Container\ContainerInterface;
use Interop\Container\ServiceProvider\ServiceProvider;
use Puli\Repository\Api\ResourceRepository;
use Puli\TwigExtension\PuliExtension;
use Puli\TwigExtension\PuliTemplateLoader;
use Puli\UrlGenerator\Api\UrlGenerator;
@mnapoli
mnapoli / PHP-DI 6.md
Last active March 15, 2016 22:11
PHP-DI 6

PHP-DI 6 ideas

Main changes:

Rename a few helpers to actions:

  • factory() -> call()
  • object() -> create()

This is hopefully clearer on what will actually be done.

@mnapoli
mnapoli / .phpstorm.meta.php
Created July 1, 2016 11:36
PHPUnit autocompletion with PhpStorm's latest EAP
<?php
namespace PHPSTORM_META {
$STATIC_METHOD_TYPES = [
\PHPUnit_Framework_TestCase::createMock('') => [
"" == "@|PHPUnit_Framework_MockObject_MockObject",
],
\PHPUnit_Framework_TestCase::getMock('') => [
"" == "@|PHPUnit_Framework_MockObject_MockObject",
],
@mnapoli
mnapoli / iterable.md
Last active July 3, 2016 20:06
Iterable
can be used with foreach(… array_*(…) functions yield from … array type-hint Traversable type-hint can be implemented
array
Traversable
iterable
#!/bin/bash
set -e
cd /tmp
echo "Installing PHP"
#mkdir /tmp/php
#curl -sSL https://s3-eu-west-1.amazonaws.com/mnapoli/test-aws/php.tar.gz | tar -xz -C /tmp/php

Usage:

php script.php test.plt

Sample output:

G01 X-7626 Y-392 Z0