Skip to content

Instantly share code, notes, and snippets.

View B-Galati's full-sized avatar
😁

Benoit GALATI B-Galati

😁
View GitHub Profile
@B-Galati
B-Galati / php.ini
Last active February 25, 2016 07:36
[xdebug]
xdebug.cli_color=1
xdebug.show_local_vars=0
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_host=<PHPSTORM host IP>
xdebug.remote_port="9000"
xdebug.idekey=phpstorm
xdebug.scream = 0
xdebug.max_nesting_level=300
@B-Galati
B-Galati / mongo_request.js
Last active March 4, 2016 10:46
Simple mongo requests
// MAJ d'un champ de tous les document d'une collection (upsert:false et multi:true)
db.dossier.update(
{},
{$set: {"entreprise.codeNAF": {"code": "NAF"}}},
false,
true
);
// Parcours d'une collection
db.dossier.find().forEach(function(dossier){
@B-Galati
B-Galati / elasticsearcIndexConfig.json
Created August 3, 2015 07:01
Exemple de configuration d'un index elasticsearch
{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"analysis": {
"analyzer": {
"stringAnalyzer": {
"type": "custom",
@B-Galati
B-Galati / .atoum.php
Last active May 7, 2016 15:34
Example of atoum configuration time
<?php
use mageekguy\atoum;
use mageekguy\atoum\report\fields\runner\failures\execute;
$cloverWriter = new atoum\writers\file('builds/tests/atoum.coverage.xml');
$cloverReport = new atoum\reports\asynchronous\clover();
$cloverReport->addWriter($cloverWriter);
$xunitWriter = new atoum\writers\file('builds/tests/atoum.xunit.xml');
$xunitReport = new atoum\reports\asynchronous\xunit();
<?php
namespace Manwin\YouPorn\WebFrontBundle\EventListener;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
class FrameHeaderListener
{
public function onKernelResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
FROM wernight/phantomjs:latest
USER root
WORKDIR /
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git
RUN git clone https://github.com/acdha/phantomjs-mixed-content-scan.git /opt/mixed-content-scanner/ \
@B-Galati
B-Galati / merge.sh
Last active April 10, 2017 23:19
recursively merge some branches
#!/usr/bin/env bash
set -x;
BRANCHES=(release/branch1 release/branch2 release/branch3 master);
FIRST=${BRANCHES[0]};
for B in ${BRANCHES[@]:1};
do
git fetch;
git checkout "$B";
git reset --hard "origin/$B";
@B-Galati
B-Galati / services.php
Last active September 2, 2017 16:41
Symfony demo with Fluent PHP format for services
<?php
use AppBundle\Command\ListUsersCommand;
use AppBundle\EventListener\CommentNotificationSubscriber;
use AppBundle\EventListener\RedirectToPreferredLocaleSubscriber;
use AppBundle\Twig\AppExtension;
use AppBundle\Utils\Slugger;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Twig\Extensions\IntlExtension;
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->exclude(__DIR__.'app/data')
;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
@B-Galati
B-Galati / UserNormalizer.php
Created May 31, 2018 07:39
Simple example of denormalizer
<?php
namespace App\Normalizer;
use App\Entity\User;
use Ramsey\Uuid\Uuid;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
class UserNormalizer implements DenormalizerInterface
{