Skip to content

Instantly share code, notes, and snippets.

View docteurklein's full-sized avatar

Florian Klein docteurklein

View GitHub Profile
<?php
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
/**
* a vim exception handler
*
* Commands a remote vim instance to display the stacktrace in a quickfix list
*
* @author Florian Klein <florian.klein@free.fr>
<!DOCTYPE html>
<html>
<head>
<script src="video-js/video.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="video-js/video-js.css" type="text/css" media="screen" title="Video JS" charset="utf-8" />
</head>
<body>
<!-- Begin VideoJS -->
<div class="video-js-box">
<!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
@docteurklein
docteurklein / extract.sh
Created December 2, 2011 16:43
extract non translated sentences in twig templates
find . -type f -name "*.html.twig" | xargs perl -pi -e "s/>([^\s<{>].*?)</>{{ '\1'|trans }}</g"
@docteurklein
docteurklein / PropelCollectionType.php
Created December 19, 2011 16:55
avoid errors when binding empty propel collection to a symfony2 form
<?php
$callback = function($data = null) {
if (empty($data)) {
return new \PropelObjectCollection();
}
return $data;
};
$builder
->appendClientTransformer(new CallbackTransformer($callback, $callback));
@docteurklein
docteurklein / gist:1591750
Created January 10, 2012 22:59
watch free mobile every hour; send a mail if not flooded anymore
watch -n 3600 'STATUS=`curl -sL -w "%{http_code}\\n" https://mobile.free.fr/souscription/jsCartValidation -o /dev/null`; test $STATUS -ne 502 && mail -s "yahoo" example@example.com'
@docteurklein
docteurklein / custome-options.sh
Created February 12, 2012 23:35
phpfarm custom options
#!/bin/bash
mkdir -p "$basedir/../etc/$version/conf.d"
etcbasedir="`readlink -f "$basedir/../etc/$version"`"
configoptions="\
--with-config-file-path=$etcbasedir
--with-config-file-scan-dir=$etcbasedir/conf.d
--enable-debug \
./Symfony/Component/Process/Exception/RuntimeException.php
./Symfony/Component/Process/Exception/ProcessFailedException.php
./Symfony/Component/Serializer/Exception/RuntimeException.php
./Symfony/Component/Serializer/Exception/UnsupportedException.php
./Symfony/Component/Serializer/Exception/Exception.php
./Symfony/Component/Serializer/Exception/UnexpectedValueException.php
./Symfony/Component/Serializer/Exception/InvalidArgumentException.php
./Symfony/Component/Serializer/Exception/LogicException.php
./Symfony/Component/DependencyInjection/Exception/RuntimeException.php
<?php
namespace App\Mongo\Repository;
use \MongoDB;
use \MongoCursor;
use \MongoId;
use \MongoDate;
use \DateTime;
use \ArrayIterator;
@docteurklein
docteurklein / gist:5064805
Created March 1, 2013 13:53
failing test case for ReflectionMethod::getPrototype() when a class is using a trait that defines a method, chich class extends another class that defines the same method too.
<?php
trait TestTrait
{
public function getKernel()
{
}
}
class BaseTest
@docteurklein
docteurklein / cli
Last active December 15, 2015 00:09
php interactive CLI with symfony ready application $ ./app/cli
#!php -ad auto_prepend_file=cli
<?php
set_time_limit(0);
require_once __DIR__.'/autoload.php';
require_once __DIR__.'/AppKernel.php';
Symfony\Component\Debug\Debug::enable();