Skip to content

Instantly share code, notes, and snippets.

@skigun
skigun / BatchEndpointAction.php
Created November 2, 2023 15:15
ApiPlatform Batch Endpoint
<?php
namespace App\ModelBundle\Controller;
use ApiPlatform\Core\Bridge\Symfony\Validator\Exception\ValidationException;
use App\ModelBundle\Model\ApiBatchItem;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
<?php
namespace App\Command;
class ImportSynchronisationCommand extends Command
{
/** @var string */
private $tableName;
/** @var string */
@skigun
skigun / FrontContext.php
Created May 16, 2023 14:17
Behat setup chrome & download
<?php
use Behat\Gherkin\Node\TableNode;
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Exception\ExpectationException;
use Behat\MinkExtension\Context\MinkContext;
use WebDriver\Exception\StaleElementReference;
use WebDriver\Key;
@skigun
skigun / .gitconfig
Created June 6, 2022 22:41
Alias git
[alias]
st = status
ci = commit -v
cim = commit -v -m "--"
co = checkout
br = branch -v
bra = branch -v -a
lg = log --graph --pretty=tformat:'%Cred%h%Creset -%C(cyan)%d %Creset%s %Cgreen(%an %cr)%Creset' --abbrev-commit --date=relative
lga = log --graph --pretty=tformat:'%Cred%h%Creset -%C(cyan)%d %Creset%s %Cgreen(%an %cr)%Creset' --abbrev-commit --date=relative --all
di = diff
@skigun
skigun / .bashrc
Created March 12, 2021 15:09
Custom BASH prompt for symfony micro service
# In order to quickly see in which container and which SF environment we are
# The default BASH prompt is overridden.
# example:
# Product 🔥 www-data(dev)>
# Product 🔥 www-data(test)>
# Supplier 🔥 www-data(prod)>
PROMPT_COMMAND=prompter
function prompter() {
@skigun
skigun / Makefile
Last active May 4, 2023 12:15
How to document the Makefile with the Symfony style
.DEFAULT_GOAL := help
ifndef CI_JOB_ID
# COLORS
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
TARGET_MAX_CHAR_NUM=30
endif
@skigun
skigun / CommandContext.php
Last active May 16, 2024 08:45
CommandContext for Behat
<?php
use Behat\Gherkin\Node\PyStringNode;
use Behat\MinkExtension\Context\RawMinkContext;
use Behat\Symfony2Extension\Context\KernelAwareContext;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Process\Process;
class CommandContext extends RawMinkContext implements KernelAwareContext
{
@skigun
skigun / .zshrc
Last active January 16, 2020 08:59
Alias bash Prowbce
# Personal
alias p="pwd"
alias vm="cd /Users/bertillon/Sites/developmentVM && vagrant"
alias vmssh="vm ssh"
alias pg="ping 8.8.8.8"
alias hacksensio="sudo ifconfig en0 lladdr #taCruLustucru"
alias t="multitail"
alias mo='meteor'
alias gremot='git remote show origin'
alias fig='docker-compose'
@skigun
skigun / boostrap.sh
Created July 17, 2019 13:46
Dinghy setup
# First step
docker run -d --restart=always \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
-v /Users/clement.bertillon/.dinghy/certs:/etc/nginx/certs \
-p 80:80 -p 443:443 -p 19322:19322/udp \
-e DNS_IP=192.168.99.100 -e CONTAINER_NAME=http-proxy \
--name http-proxy \
codekitchen/dinghy-http-proxy
# After that inside the container
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/app')
;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([