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 / mkcert-install.sh
Last active December 4, 2020 19:35
A script to automatically install mkcert locally if not installed globally
#!/usr/bin/env bash
#
# A lot of inspiration comes directly from symfony cli installer
set -euo pipefail
ROOT_PATH=$(
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
pwd
@B-Galati
B-Galati / 0-vagrant-rsync-auto.sh
Last active December 15, 2020 08:54
Run vagrant rsync-auto as a daemon
#!/usr/bin/env bash
set -euo pipefail
ROOT_PATH=$(set -e && cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd "${ROOT_PATH}"
# Taken from Symfony installer
function output
{
@B-Galati
B-Galati / keybase.md
Created June 16, 2019 08:07
keybase.md

Keybase proof

I hereby claim:

  • I am B-Galati on github.
  • I am bgalati (https://keybase.io/bgalati) on keybase.
  • I have a public key whose fingerprint is B675 6E4A F33E 081D AB03 719C D8F2 5183 44D9 921B

To claim this, I am signing this object:

@B-Galati
B-Galati / Makefile
Last active October 15, 2018 12:46
Rebuild docker images only when they are modified
DOCKER_COMPOSE?=docker-compose
DOCKER_FILES=$(shell find ./docker/dev/ -type f -name '*')
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
##
<?php
use AppBundle\DataFixtures\ORM\LoadAdherentData;
use AppBundle\Entity\Adherent;
use AppBundle\Entity\Administrator;
use AppBundle\Repository\AdherentRepository;
use AppBundle\Repository\AdministratorRepository;
use Behat\Mink\Driver\Selenium2Driver;
use Behat\MinkExtension\Context\RawMinkContext;
use Behat\Symfony2Extension\Context\KernelDictionary;
@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
{
<?php
use Behat\Gherkin\Node\TableNode;
use Behat\MinkExtension\Context\RawMinkContext;
use Behat\Symfony2Extension\Context\KernelDictionary;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\ORM\EntityManager;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
@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 / Makefile
Last active December 17, 2020 15:32
Example of Makefile for php script
.PHONY: help clean build vendor node_modules test php-cs-fixer
SYMFONY_ENV ?= dev
SYMFONY_CONSOLE_ARGS ?= --env=dev
SYMFONY_ASSETS_INSTALL ?= relative
COMPOSER_ARGS ?=
PHP=php
ifneq ($(SYMFONY_ENV), dev)
COMPOSER_ARG = --optimize-autoloader --no-dev --no-suggest --no-interaction --classmap-authoritative