Skip to content

Instantly share code, notes, and snippets.

View clemherreman's full-sized avatar

Clement Herreman clemherreman

  • Exotec
  • Lille, France
View GitHub Profile
@clemherreman
clemherreman / test.php
Last active December 10, 2015 10:08
PHP unreferencing
<?php
$a = new stdClass();
$a->prop = 'objA';
$b = new stdClass();
$b->prop = 'objB';
$c = array($a, $b);
echo 'before unsetting'.PHP_EOL;
@clemherreman
clemherreman / .bash_profile
Last active December 10, 2015 04:18
Change the PHP version used in Mac Os
# Change CLI binary
# This way Mac OS Looks first in our brand new php binary folder,
# then fallback to the built-in (old) version of PHP
export PATH=/path/to/PHP/installed/by/macport/bin:$PATH
<?php
namespace Novadry\AvisBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
use Novadry\AvisBundle\Form\WYSIWYG\CKEditorOptions;
@clemherreman
clemherreman / AddMarkValueSubscriber.php
Created December 20, 2012 15:35
How to add a field to a symfony2 form on preSetData
<?php
namespace MyNamespace\ReviewBundle\Form\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface,
Symfony\Component\Form\FormFactoryInterface,
Symfony\Component\Form\FormEvents,
Symfony\Component\Form\Event\DataEvent;
/**
phploc 1.7.4 by Sebastian Bergmann.
Directories: 98
Files: 447
Lines of Code (LOC): 58702
Cyclomatic Complexity / Lines of Code: 0.04
Comment Lines of Code (CLOC): 24461
Non-Comment Lines of Code (NCLOC): 34241
@clemherreman
clemherreman / function.php
Created November 23, 2012 15:09
Turn url to clickable links © symfony 1.4
<?php
if (!defined('SF_AUTO_LINK_RE'))
{
define('SF_AUTO_LINK_RE', '~
( # leading text
<\w+.*?>| # leading HTML tag, or
[^=!:\'"/]| # leading punctuation, or
^ # beginning of line
)
@clemherreman
clemherreman / config_dev.yml
Created November 6, 2012 11:40
Show GA only in some environments
twig:
globals:
glob_showGA: false
@clemherreman
clemherreman / PULL_REQUEST
Created November 6, 2012 09:40
Test content for defunkt/hub #235
[Test] Vérification que le bug de github est fixé
Celui qui empéchait les PR avec des caractères non ASCII
# Requesting a pull to widop:develop from widop:f-test-bug-github
#
# Write a message for this pull request. The first block
# of text is the title and the rest is description.
@clemherreman
clemherreman / phpbb_hash.php
Created November 5, 2012 10:06
PHPBB way of generating a password
<?php
/**
*
* @version Version 0.1 / slightly modified for phpBB 3.0.x (using $H$ as hash type identifier)
*
* Portable PHP password hashing framework.
*
* Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
* the public domain.
*
@clemherreman
clemherreman / gist:3959674
Created October 26, 2012 16:09
Behat scenario example
# features/sha1.feature
Feature: Sha1
In order to compute a sha1sum
As a website user
I need to be able to compte a sha1sum using an asynchronous script
Scenario: Compute sha1sum
Given I am on "/"
When I fill in "text" with "my text"
Then I should see "c3599c11e47719df18a2448690840c5dfcce3c80"