Skip to content

Instantly share code, notes, and snippets.

View maximecolin's full-sized avatar

Maxime COLIN maximecolin

View GitHub Profile
@maximecolin
maximecolin / ConsoleListener.php
Last active August 15, 2023 21:17
Symfony2 : Configuring the Request Context for CLI Command
<?php
namespace Acme\DemoBundle\EventListener;
use Symfony\Component\Routing\RouterInterface;
class ConsoleListener
{
/**
* @var RouterInterface
@maximecolin
maximecolin / GIF-Screencast-OSX.md
Created August 27, 2021 13:36 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@maximecolin
maximecolin / LoadData.php
Last active December 17, 2020 10:51
Faker uploaded file provider
<?php
namespace Acme\DemoBundle\Fixtures\ORM;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Nelmio\Alice\Fixtures;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Core\User\UserInterface;
@maximecolin
maximecolin / MyController.php
Created February 16, 2015 11:26
Symfony2 : add translated flash with parameters, domain or locale
<?php
namespace Acme\DemoBundle;
use Symfony\Bundle\FrameworkBundle\Controller\Controller
class MyController extends Controller
{
/**
* @Template()
@maximecolin
maximecolin / graphql.php
Created June 12, 2018 10:05
GraphQL multiple mutation test
<?php
// Test this using following command
// php -S localhost:8080 ./graphql.php &
// curl http://localhost:8080 -d '{"query": "query { echo(message: \"Hello World\") }" }'
// curl http://localhost:8080 -d '{"query": "mutation { sum(x: 2, y: 2) }" }'
require_once __DIR__ . '/vendor/autoload.php';
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type;
use GraphQL\Type\Schema;
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
@maximecolin
maximecolin / all.yml
Last active September 14, 2017 21:34
Telegraf + InfluxDB + Grafana ansible provisoning with manala.io
_env: prod
##############
# Apt Config #
##############
manala_apt_preferences:
- influxdb@influxdata
- telegraf@influxdata
- grafana@grafana
@maximecolin
maximecolin / System.json
Created November 17, 2016 09:15
Grafana System Dashboard
{
"__inputs": [
{
"name": "DS_INFLUXDB",
"label": "influxdb",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
@maximecolin
maximecolin / System.json
Created November 17, 2016 09:15
Grafana System Dashboard
{
"__inputs": [
{
"name": "DS_INFLUXDB",
"label": "influxdb",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
/**
* Has join
*
* @param string $root
* @param string $relation
*
* @return bool
*/