Skip to content

Instantly share code, notes, and snippets.

View lyrixx's full-sized avatar
😀

Grégoire Pineau lyrixx

😀
View GitHub Profile
@lyrixx
lyrixx / unset.php
Created February 19, 2014 20:55
Ensure visibility of a property does not change when unseted
<?php
class Foobar
{
private $foo = 'start';
public function getFoo()
{
return $this->foo;
}
@lyrixx
lyrixx / refresh-assetic.sh
Last active August 29, 2015 13:56
Refresh assetic on any modification
#!/bin/bash
BASE_PATH=`dirname $0`/..
ASSETS_PATH=$BASE_PATH/app/Resources/assets
ASSETS_PATH2=$BASE_PATH/src/SensioLabs/Bundle/InsightAnalysisBundle/Resources/public
if [[ `which inotifywait` ]]; then
while true; do
inotifywait -r -e modify -e move -e create -e delete $ASSETS_PATH/ $ASSETS_PATH2/ | while read line; do
php $BASE_PATH/app/console assetic:dump --force
@lyrixx
lyrixx / MessageExporter.php
Created June 19, 2014 07:40
Export all messages from an AMQP queue
<?php
class MessageExporter
{
private $broker;
public function __construct(Broker $broker = null)
{
$this->broker = $broker;
}
@lyrixx
lyrixx / keybase.md
Created September 22, 2014 16:08
keybase.md

Keybase proof

I hereby claim:

  • I am lyrixx on github.
  • I am lyrixx (https://keybase.io/lyrixx) on keybase.
  • I have a public key whose fingerprint is EBD3 7A8B 0142 8B8F CFBE 0159 4F0F C894 7EAE A13A

To claim this, I am signing this object:

@lyrixx
lyrixx / monolog.lua
Last active August 29, 2015 14:07
Monolog.lua
-- Sample input:
-- {
-- "message": "Reloading user from user provider.",
-- "context": [
-- ],
-- "level": 100,
-- "level_name": "DEBUG",
-- "channel": "security",
-- "datetime": {
-- "date": "2014-05-23 14:19:19",
@lyrixx
lyrixx / test.php
Last active August 29, 2015 14:07
test melody
<?php
<<<CONFIG
packages:
- "twig/twig: *"
CONFIG;
echo "----------------------------------\n";
$twig = new Twig_Environment(new Twig_Loader_Array(array(
'my_template' => 'Hello {{ name }}',
@lyrixx
lyrixx / melody.php
Created December 5, 2014 22:22
Melody demo
<?php
<<<CONFIG
packages:
- "symfony/finder: ~2.5"
CONFIG;
$finder = Symfony\Component\Finder\Finder::create()
->in(__DIR__)
->name('*.php')
;
@lyrixx
lyrixx / symfony-and-melody.php
Last active August 29, 2015 14:13
Symfony in a single file, for melody
<?php
<<<CONFIG
packages:
- "symfony/symfony: 2.7.x-dev@dev"
CONFIG;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
@lyrixx
lyrixx / .gitignore
Last active August 29, 2015 14:17
phpunit error
/vendor/
@lyrixx
lyrixx / VersionCalculator.php
Last active August 29, 2015 14:18
VersionCalculator
<?php
namespace SensioLabs\Toolkit\Assets;
use Assetic\AssetManager;
use Assetic\Asset\AssetCollection;
use Symfony\Component\Finder\Finder;
class VersionCalculator
{