Skip to content

Instantly share code, notes, and snippets.

View wouterj's full-sized avatar

Wouter de Jong wouterj

View GitHub Profile
testwork:
testers:
strict: true
@wouterj
wouterj / security.php
Last active September 27, 2015 09:30
<?php
$authenticator = new AuthenticationProviderManager([
new DaoAuthenticationProvider(
new InMemoryUserProvider([
'wouter' => ['password' => 'test', 'roles' => ['ROLE_USER']]
]),
new UserChecker(),
'cli',
new EncoderFactory([
<?php
// ...
class MyController extends Controller
{
/**
* @Route("/", name="neuro_index")
*/
public function indexAction()
@wouterj
wouterj / README.md
Last active August 29, 2015 14:21 — forked from weaverryan/README.md
Welcome to the Symfony Documentation Hack Day May 23rd, 2015

It's Documentation Hack Day!

Welcome! No matter what you're level of Symfony or how you feel about your English (I'm sure it's just fine), we have plenty of things we need help with! This document will guide you through everything:

Where Are we Meeting?

We're meeting on Freenode in the #symfony-docs channel. Come hang out!

What Can I Work On?

@wouterj
wouterj / 1-life.php
Last active August 29, 2015 14:21
Game of Life
<?php
function life($i){foreach($i as$j=>$a)foreach($a as$k=>$b){$l=array_sum([($r=!!@$i[$x=$y=$j-1])&&$i[$x][$k],($R=!!@$i[$y+=2])&&$i[$y][$k],($u=$i[$j])&&($c=isset($u[$z=$k-1]))&&$u[$z],$c&&$r&&$i[$x][$z],$c&&$R&&$i[$y][$z],($C=isset($u[$z+=2]))&&$u[$z],$C&&$r&&$i[$x][$z],$C&&$R&&$i[$y][$z]]);$o[$j][$k]=$b?(!($l<2||$l>3)):($l==3);}return$o;}
->then(function ($n) {
$options = array();
foreach ($n as $name => $value) {
if ('type' === $name) {
continue;
}
$options[$name] = $n[$name];
unset($n[$name]);
data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iNDE3cHgiIGhlaWdodD0iMzAwcHgiIHZpZXdCb3g9IjAgMCA0MTcgMzAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0MTcgMzAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnIGlkPSJMYXllcl8xXzFfIj4NCgk8ZyBpZD0ib3V0bGluZV8xXyI+DQoJCTxwYXRoIGZpbGw9IiNCNUI1QjYiIGQ9Ik0yNzUuOSwxNDVjMCwxOC4yLTE0Ljc5OSwzMy0zMywzM0gxMjAuNzAxbC0zNi4zLDQybC0wLjMtNDJINDBjLTE4LjIsMC0zMy0xNC44LTMzLTMzVjQ0DQoJCQljMC0xOC4yLDE0LjgtMzMsMzMtMzNoMjAyLjljMTguMTk5LDAsMzMsMTQuOCwzMywzM1YxNDVMMjc1LjksMTQ1eiIvPg0KCTwvZz4NCgk8ZyBlbmFibGUtYmFja2dyb3VuZD0ibmV3ICAgICI+DQoJCT
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
$form = $formBuilder
// ... add the fields
->add('delete', 'submit') // add delete button
->add('save', 'submit') // add save button
->getForm();
$form->handleRequest($request);
@wouterj
wouterj / explaination.md
Last active August 29, 2015 14:16
The confusing world of Symfony DI configuration files

It all starts with the booting of the kernel, which builds the container. As you see, $this->registerContainerConfiguration() is called (an abstract method)

class Kernel
{
    protected function buildContainer()
    {
        $container = $this->getContainerBuilder();
        $container->addObjectResource($this);