Skip to content

Instantly share code, notes, and snippets.

Avatar

Tristan Bessoussa tristanbes

View GitHub Profile
@tristanbes
tristanbes / config.yml
Created Feb 22, 2013
Session cookie name for Symfony2 and subdomains
View config.yml
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 }
@tristanbes
tristanbes / services.xml
Created Nov 23, 2012
Controller Example of Monitor your Symfony2 application via Stats.d and Graphite (2/2)
View services.xml
<service id="seek_team_premium.contact.listener" class="SeekTeam\PremiumBundle\Event\Listener\StatsListener">
<tag name="kernel.event_subscriber" />
<argument type="service" id="liuggio_stats_d_client.factory" />
<argument type="service" id="liuggio_stats_d_client.service" />
</service>
@tristanbes
tristanbes / StatsListener.php
Created Nov 23, 2012
Controller Example of Monitor your Symfony2 application via Stats.d and Graphite (2/2)
View StatsListener.php
<?php
namespace SeekTeam\PremiumBundle\Event\Listener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use SeekTeam\PremiumBundle\Event\Events;
class StatsListener implements EventSubscriberInterface
@tristanbes
tristanbes / Events.php
Created Nov 23, 2012
Monitor your Symfony2 application via Stats.d and Graphite (2/2)
View Events.php
<?php
namespace SeekTeam\PremiumBundle\Event;
final class Events
{
const PREMIUM_START = 'gamercertified.premium.start';
const PREMIUM_SUCCESS = 'gamercertified.premium.success';
const PREMIUM_CANCEL = 'gamercertified.premium.cancel';
const PREMIUM_ERROR = 'gamercertified.premium.error';
@tristanbes
tristanbes / DefaultController.php
Created Nov 23, 2012
Controller Example of Monitor your Symfony2 application via Stats.d and Graphite (2/2)
View DefaultController.php
<?php
namespace SeekTeam\PremiumBundle\Controller;
use SeekTeam\HomeBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use JMS\SecurityExtraBundle\Annotation\Secure;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\GenericEvent;
@tristanbes
tristanbes / StatsDClientBundle.php
Created Nov 9, 2012
StatsDClientBundle installation
View StatsDClientBundle.php
// composer.json
"require": {
# ..
"liuggio/statsd-client-bundle": ">=1.2",
# ..
}
// After running php composer.phar update liuggio/statsd-client-bundle
// Enable the Bundle in AppKernel.php
@tristanbes
tristanbes / example.sh
Created Nov 9, 2012
Install Graphite on Debian Server
View example.sh
# 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
@tristanbes
tristanbes / gist:3918310
Created Oct 19, 2012
Install Stats.d on a debian server
View gist:3918310
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev
# Don't forget to go to the location you want to install node in (like cd /home/) before running these commands
git clone https://github.com/joyent/node.git
cd node
git checkout v0.8.12
./configure --openssl-libpath=/usr/lib/ssl
make
make test
View config
# Add the bundle to your composer
"a2lix/translation-form-bundle" : "dev-master"
# Enable the Bundle in the AppKernel.php
new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
# Configure the Bundle in the config.yml
View ProfileAdmin.php
<?php
namespace AwesomeNamespace\AwesomeBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
/**
* Profile Admin
You can’t perform that action at this time.