Skip to content

Instantly share code, notes, and snippets.

Avatar

Adrien Brault adrienbrault

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am adrienbrault on github.
  • I am adrienbrault (https://keybase.io/adrienbrault) on keybase.
  • I have a public key ASCXSSS8Y_xa0IbDKpZn5iMJC2FFh7IQDmrWjaOh1gVv7go

To claim this, I am signing this object:

@adrienbrault
adrienbrault / httpie
Last active Feb 2, 2018
Snippets to quickly install stuff on centos
View httpie
#!/bin/bash
sudo yum install -y python-pip
sudo pip install httpie
#
@adrienbrault
adrienbrault / gist:7063740
Last active Dec 26, 2015
symfony/symfony test suite on hhvm 2.2.0
View gist:7063740
vagrant@vagrant-ubuntu-saucy-64:/vagrant/symfony$ hhvm ../phpunit/composer/bin/phpunit
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from /vagrant/symfony/phpunit.xml.dist
...........................EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 59 / 11750 ( 0%)
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 118 / 11750 ( 1%)
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 177 / 11750 ( 1%)
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE... 236 / 11750 ( 2%)
..........EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.......EEEEEEEEE. 295 / 11750 ( 2%)
@adrienbrault
adrienbrault / extension.php
Created Oct 18, 2013
instanceof twig test
View extension.php
<?php
class LayoutExtension extends \Twig_Extension
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'yolo';
@adrienbrault
adrienbrault / 1_hateoas.md
Last active Dec 18, 2015
Hateoas php library features ideas/wishlist
View 1_hateoas.md

I'm about to start writing a new php library for hateoas stuff. Here are my thoughts about what features it should have. If you have comments/suggestions/ideas/requests/whatever, please comment the gist.

  • php 5.3 library
  • hooking into the jms serializer
  • support multiple hateoas "formats/standards" (hal, etc)
  • configuration layer
    • static configuration: php, yaml, annotations, extension api for other libraries (being cached)
    • dynamic configuration, attach configuration to an object
@adrienbrault
adrienbrault / guzzle.php
Created Apr 8, 2013
Download a file using guzzle
View guzzle.php
<?php
$client = ...;
$response = $client->get('http://guzzlephp.org/index.html', null, tmpfile())->send();
$response->getStream(); // Magic comes after
View AbstractInvoiceLineType.php
<?php
// ...
class AbstractInvoiceLineType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
// ...
@adrienbrault
adrienbrault / 0desc.md
Last active Dec 14, 2015
Benchmark https://github.com/mtdowling/ClassPreloader on symfony2 standard edition homepage.
View 0desc.md

Note that the prod environment home page is a 404, and this is a micro/unreal benchmark

I also had to fix some bugs manually, they're not all documented here, pr/issue soon

The tests were run on an EC2 small instance, Ubuntu 11.10.

$ php -v
PHP 5.4.6-1ubuntu1.1 (cli) (built: Nov 15 2012 01:18:34) 
Copyright (c) 1997-2012 The PHP Group
View CollectionTypeExtension.php
<?php
namespace Incenteev\Bundle\Form\Extension;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* @author Adrien Brault <adrien.brault@gmail.com>