Skip to content

Instantly share code, notes, and snippets.

Avatar

Florian Klein docteurklein

View GitHub Profile
View AclManager.php
<?php
public function createClassAce(ObjectIdentity $objectIdentity, User $user = null, MaskBuilder $maskBuilder = null)
{
if( ! $user) {
$user = $this->getUser();
}
if( ! $user instanceof \Symfony\Component\Security\Core\User\AccountInterface)
{
throw new \InvalidArgumentException('you must have a User in "security.context"');
}
View WhatTheFuck.php
<?php
class Test
{
public function whatTheFuck()
{
${'thi' . 's'} = 'tata';
$name = 'this';
var_dump($this);
View bind.js
Function.prototype.bind = function(context) {
if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
var __method = this, args = slice.call(arguments, 1);
return function() {
var a = merge(args, arguments);
return __method.apply(context, a);
}
}
@docteurklein
docteurklein / silex_app.php
Created Apr 8, 2011
a little silex app to show doctrineExtension capabilities
View silex_app.php
<?php
require_once __DIR__.'/../Silex/silex.phar';
use Silex\Extension\DoctrineExtension;
$app = new Silex\Application;
$app->register(new DoctrineExtension, array(
'doctrine.dbal.connection_options' => array(
@docteurklein
docteurklein / UniversalClassLoaderChecker.php
Created Apr 28, 2011
a class to check classLoader configuration
View UniversalClassLoaderChecker.php
<?php
namespace Symfony\Component\ClassLoader;
class UniversalClassLoaderChecker
{
public function check(UniversalClassLoader $classLoader)
{
return array_merge(
$this->checkNamespaces($classLoader),
@docteurklein
docteurklein / browser_types.xml
Created May 1, 2011
phantomJS config for sahi
View browser_types.xml
<browserTypes>
<browserType>
<name>phantomjs</name>
<displayName>PhantomJS</displayName>
<icon>chrome.png</icon>
<path>/opt/phantomjs/bin/phantomjs</path>
<options>--proxy=localhost:9999 /opt/phantomjs/null.js</options>
<processName>phantomjs.sh</processName>
<capacity>5</capacity>
@docteurklein
docteurklein / sub.sh
Created May 10, 2011
init submodules from a .gitmodules file
View sub.sh
#!/bin/bash
for cfg in `git config -f .gitmodules -l`
do
url=`echo $cfg | awk -F"submodule.*.url=" '{print $2}'`;
if [ -n "$url" ]; then
echo "git submodule add $url $path";
git submodule add $url $path;
View update_core_config.sh
#!/bin/sh
if test -z "$1"
then
echo "Please give database name"
echo "Usage: $0 <db_name> <URL>"
return
fi
if test -z "$2"
@docteurklein
docteurklein / sahi_step.json
Created Jul 2, 2011
corresponding sahi step of: When I fill in "knplabs-translator-value" with "It's alive, ALIVE!"
View sahi_step.json
{'origStep':+"_sahi._setValue(_sahi._byXPath(\"(.//*[self::input+|+self::textarea+|+self::select][not(./@type+=+'submit'+or+./@type+=+'image'+or+./@type+=+'hidden')][(((./@id+=+'knplabs-translator-value'+or+./@name+=+'knplabs-translator-value')+or+./@id+=+//label[contains(normalize-space(string(.)),+'knplabs-translator-value')]/@for)+or+./@placeholder+=+'knplabs-translator-value')]+|+.//label[contains(normalize-space(string(.)),+'knplabs-translator-value')]//.//*[self::input+|+self::textarea+|+self::select][not(./@type+=+'submit'+or+./@type+=+'image'+or+./@type+=+'hidden')])[1]\"),+\"It's+alive,+ALIVE!\")",+'step':+"_sahi._setValue(_sahi._byXPath(\"(.//*[self::input+|+self::textarea+|+self::select][not(./@type+=+'submit'+or+./@type+=+'image'+or+./@type+=+'hidden')][(((./@id+=+'knplabs-translator-value'+or+./@name+=+'knplabs-translator-value')+or+./@id+=+//label[contains(normalize-space(string(.)),+'knplabs-translator-value')]/@for)+or+./@placeholder+=+'knplabs-translator-value')]+|+.//label[contains(normalize
View SmartKernel.php
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Finder\Finder;
class SmartKernel extends Kernel
{
public function registerBundles()
{
You can’t perform that action at this time.