Skip to content

Instantly share code, notes, and snippets.

View notFloran's full-sized avatar

Floran Brutel notFloran

View GitHub Profile
@notFloran
notFloran / ApiRender.php
Created November 18, 2018 10:50
Use MJML API with notfloran/mjml-bundle
<?php
# src/Mjml/ApiRenderer.php
namespace App\Mjml;
use Mjml\Client;
use NotFloran\MjmlBundle\Renderer\RendererInterface;
class ApiRenderer implements RendererInterface
@notFloran
notFloran / remove_php.sh
Last active April 26, 2018 09:21
Homebrew - remove PHP and its config
# remove all php and extensions, use "brew list | grep php" to get all packages
brew uninstall --force --ignore-dependencies php71-xdebug php71-amqp php71 ....
# remove all configs
rm -rf /usr/local/etc/php/7.1
rm -rf /usr/local/opt/php@7.1
rm -rf /usr/local/share/pear
rm -rf /usr/local/lib/php/
rm -rf /usr/local/Cellar/php@71
@notFloran
notFloran / LoggerPlugin.php
Created April 4, 2018 19:23
Log all emails sent with Swiftmailer
<?php
namespace App\Swiftmailer;
use Psr\Log\LoggerInterface;
use Swift_Events_SendEvent;
use Swift_Events_SendListener;
class LoggerPlugin implements Swift_Events_SendListener
{
@notFloran
notFloran / SentryExceptionCatcherProcessor.php
Created June 7, 2017 08:50
SentryExceptionCatcherProcessor for Swarrot
<?php
namespace Hexanet\Si\AppBundle\Processor\Swarrot;
use Swarrot\Broker\Message;
use Swarrot\Processor\ProcessorInterface;
class SentryExceptionCatcherProcessor implements ProcessorInterface
{
/**
@notFloran
notFloran / create_server.php
Created April 29, 2015 19:29
PHP script to create a server on Runabove with php-opencloud
<?php
require 'vendor/autoload.php';
use OpenCloud\OpenStack;
use Guzzle\Http\Exception\BadResponseException;
$client = new OpenStack('https://auth.runabove.io/v2.0/', array(
'username' => '', // email
'password' => '',
app.factory('Authentication', function($http, $rootScope, $location, $timeout){
var Auth = {};
Auth.unsetUser = function() {
$rootScope.user = {};
};
Auth.setUser = function(data) {
$rootScope.user = data;
@notFloran
notFloran / install.sh
Created August 12, 2014 15:14
Logstash-forwarder debian 7
wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -
echo 'deb http://packages.elasticsearch.org/logstashforwarder/debian stable main' > /etc/apt/sources.list.d/logstash-forwarder.list
@notFloran
notFloran / php-amqp.sh
Last active March 26, 2016 21:00
Install amqp extension for php - Debian 7
#!/bin/sh
apt-get install php5-dev make cmake php-pear
git clone git://github.com/alanxz/rabbitmq-c.git && cd rabbitmq-c
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
cmake --build . --target install
@notFloran
notFloran / .gitconfig
Created January 21, 2014 20:22
Git : use http when ssh is blocked
[url "http://git.floran.fr/"]
insteadOf = git@git.floran.fr:
#!/usr/bin/php
<?php
/**
* .git/hooks/pre-commit
*
* This pre-commit hooks will check for PHP error (lint), and make sure the code
* is PSR compliant.
*
* Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer)
*