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
const WORD = 'MY FANCY WORD';
const JOKER = '\'';
$parts = [];
$i = 0;
foreach (str_split(strrev(WORD)) as $word) {
$parts[pow(2, $i++)] = $word;
}
@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
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 / 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 <remy@wisembly.com>
* @author Baptiste Clavié <baptiste@wisembly.com>
*/
<?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');
<?php
class DoctrineItemSummaryListener implements EventSubscriber
{
/** @var TagcloudGenerator */
private $tagcloud;
public function __construct(TagcloudGenerator $tagcloud)
{
$this->tagcloud = $tagcloud;
}
<?php
namespace MyBundle\Exception;
use \InvalidArgumentException;
use Symfony\Component\Form\FormError,
Symfony\Component\Form\FormInterface;
/**
<?php
$builder->add('current_slide', 'text', ['mapped' => falsei, 'constraint' => new Regex(['pattern' => '`^\d*$`'])]);
@Taluu
Taluu / gist:6111938
Last active December 20, 2015 09:59
dafuq ?!
#include <stdio.h>
#include <stdlib.h>
int main() {
int i = 42,
j = 42,
k = 42,
sum = 0;
<service id="un.service" class="%un.service%">
<argument type="service" id="doctrine.orm.entity_manager" />
<argument type="service" id="validator" />
<!-- etc //-->
</service>