Skip to content

Instantly share code, notes, and snippets.

@adrienbrault
adrienbrault / keybase.md
Created January 23, 2019 14:43
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 February 2, 2018 09:24
Snippets to quickly install stuff on centos
#!/bin/bash
sudo yum install -y python-pip
sudo pip install httpie
#
@adrienbrault
adrienbrault / gist:7063740
Last active December 26, 2015 00:19
symfony/symfony test suite on hhvm 2.2.0
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 October 18, 2013 18:02
instanceof twig test
<?php
class LayoutExtension extends \Twig_Extension
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'yolo';
@adrienbrault
adrienbrault / 1_hateoas.md
Last active December 18, 2015 18:30
Hateoas php library features ideas/wishlist

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 April 8, 2013 16:40
Download a file using guzzle
<?php
$client = ...;
$response = $client->get('http://guzzlephp.org/index.html', null, tmpfile())->send();
$response->getStream(); // Magic comes after
<?php
// ...
class AbstractInvoiceLineType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
// ...
@adrienbrault
adrienbrault / 0desc.md
Last active December 14, 2015 09:19
Benchmark https://github.com/mtdowling/ClassPreloader on symfony2 standard edition homepage.

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
<?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>