Skip to content

Instantly share code, notes, and snippets.

View Taluu's full-sized avatar
🖕
vim is the true editor !

Baptiste Clavié Taluu

🖕
vim is the true editor !
View GitHub Profile
<?php
$builder->add('current_slide', 'text', ['mapped' => falsei, 'constraint' => new Regex(['pattern' => '`^\d*$`'])]);
<?php
namespace MyBundle\Exception;
use \InvalidArgumentException;
use Symfony\Component\Form\FormError,
Symfony\Component\Form\FormInterface;
/**
<?php
class DoctrineItemSummaryListener implements EventSubscriber
{
/** @var TagcloudGenerator */
private $tagcloud;
public function __construct(TagcloudGenerator $tagcloud)
{
$this->tagcloud = $tagcloud;
}
<?php
$a = $b = ['a' => 'a',
'b' => new Datetime('10 minutes ago'),
'c' => ['a' => 'a',
'b' => new Datetime('20 minutes ago')]];
$b['b'] = new Datetime('+10 minutes');
//$b['c']['b'] = new Datetime('+20 minutes');
@Taluu
Taluu / Change.php
Created October 28, 2013 16:18
Changeset Arrays (maybe more)
<?php
namespace Taluu\Domain\ChangeSet;
/**
* Represents a change into the entity
*
* @author Rémy Gazelot <[email protected]>
* @author Baptiste Clavié <[email protected]>
*/
<?php
use Behat\Behat\Event\SuiteEvent,
Behat\Behat\Event\FeatureEvent,
Behat\Behat\Event\ScenarioEvent,
Behat\Gherkin\Node\TableNode,
Behat\Gherkin\Node\PyStringNode,
Behat\Behat\Exception\PendingException,
@Taluu
Taluu / lexemes.rb
Last active August 29, 2015 13:56
Following nohar's tutorial :) http://calmettes.arnaud.free.fr/compilation.pdf (FR)
#!/usr/bin/env ruby
module Compiler
module Lexeme
CAT = ''
UNION = '|'
OPTION = '?'
REPEAT = '+'
CLOSURE = '*'
<?php
const WORD = 'MY FANCY WORD';
const JOKER = '\'';
$parts = [];
$i = 0;
foreach (str_split(strrev(WORD)) as $word) {
$parts[pow(2, $i++)] = $word;
}
@Taluu
Taluu / gist:9470625
Created March 10, 2014 18:08
One tagcloud to rule them all
<?php
/*
* Several strings to interpret
* With possibly several expressions in each of those
* In the service where the cloud lies within
* One string to interpret, One string to ease the perfs
* One string to bring out some stats, and in an array binds them
* In the service where the cloud lies within
*/
// some code §
<?php
use Symfony\Component\Process\ProcessBuilder,
Symfony\Component\Process\ProcessUtils;
$builder = new ProcessBuilder;
$builder->setPrefix(['--argument-name', 'argument value']);
// after the ProcessUtils