Skip to content

Instantly share code, notes, and snippets.

View tristanbes's full-sized avatar

Tristan Bessoussa tristanbes

View GitHub Profile
<?php
namespace Tristanbes\ElophantBundle\EventListener;
use Guzzle\Http\Exception\BadResponseException;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Tristanbes\ElophantBundle\Manager\StatsManager;
<?php
namespace Tristanbes\ElophantBundle\EventListener;
use Guzzle\Http\Exception\BadResponseException;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Tristanbes\ElophantBundle\Manager\StatsManager;
@tristanbes
tristanbes / Book.php
Created March 19, 2012 15:29
How to dynamically add translations to your I18N object using SonataAdminBundle & DoctrineExtensions
<?php
namespace Demo\BookBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Demo\BookBundle\Entity\Book
@tristanbes
tristanbes / snapshot.sh
Created August 29, 2017 10:04 — forked from danharper83/snapshot.sh
Creates a snapshot on platform using platform commands
#!/usr/bin/env bash
ORIGIN="develop"
TARGET="master"
if [ "$PLATFORM_BRANCH" = "$ORIGIN" ]; then
/app/.platformsh/bin/platform self-update -y -q
/app/.platformsh/bin/platform backup -y -q -p $PLATFORM_PROJECT -e $TARGET
fi
@tristanbes
tristanbes / config.yml
Created February 22, 2013 12:47
Session cookie name for Symfony2 and subdomains
framework:
esi: { enabled: true }
translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: %kernel.debug%
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
# If you open your Ressource monitoring under OSX, you'll see that the
# Process "Spotify Helper" is eating between 20% and 30% of CPU constantly
# It means that when you're on battery, it'll drain it faster.
# To prevent the Spotify Helper (which are basically ads for spotify) from spawning process,
# you should disable access to the app doing this (close Spotify first) :
sudo chmod 000 "/Applications/Spotify.app/Contents/Frameworks/Spotify Helper EH.app"
sudo chmod -N "/Applications/Spotify.app/Contents/Frameworks/Spotify Helper EH.app"
@tristanbes
tristanbes / example.sh
Created November 9, 2012 15:53
Install Graphite on Debian Server
# Installing graphite dependencies
apt-get install -y python2.6 python-pip python-cairo python-django python-django-tagging
apt-get install -y libapache2-mod-wsgi python-twisted python-memcache python-pysqlite2 python-simplejson
pip install whisper
pip install carbon
pip install graphite-web
# Setup a vhost by grabbing the example the graphite team released on their repo.
# In this file, you'll provide the url used to access to your Graphite dashboard
wget https://raw.github.com/tmm1/graphite/master/examples/example-graphite-vhost.conf -O /etc/apache2/sites-available/graphite
/// 1ST proposal
wamiz.user_registration {
email: ...
firstName: ...
}
consoanimo.user_registration {
email: ...