Skip to content

Instantly share code, notes, and snippets.

View immutef's full-sized avatar

immutef

  • SCAYLE GmbH
  • Hamburg, Germany
View GitHub Profile
@immutef
immutef / TestCommand.php
Created December 10, 2011 12:56
ZeroMQ Fan In/Out + Kill
<?php
/**
* I'd like to use IPC sockets (ipc://foo.ipc) but my virtual machine won't let me ... :)
* IPC sockets will be faster than TCP, so this script could run even faster than it does!
*/
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
<?php
namespace Turtle\ApiBundle\Serializer\Normalizer;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer,
Symfony\Component\Serializer\SerializerInterface;
class DateTimeNormalizer extends AbstractNormalizer
{
/**
@immutef
immutef / ConfigureMenuEvent.php
Created April 30, 2011 09:35
MenuBundle EventDispatcher integration
<?php
namespace Turtle\AcpBundle\Event;
use Symfony\Component\EventDispatcher\Event;
use Knplabs\Bundle\MenuBundle\Menu;
class ConfigureMenuEvent extends Event
{
@immutef
immutef / response.html
Created November 21, 2010 22:29
REST response formats [DRAFT]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body data-version="1.0">
<section role="errors">
<article data-code="404">
Not found
@immutef
immutef / config.yml
Created November 13, 2010 09:36
REST configuration [DRAFT]
rest.config:
users:
path: /users
provider: users
properties: [id]
methods: [*index, read, *create, update, delete] # methods prefixed with * are property-less
formats: [html, json, xml, yaml]
providers:
users:
/**
* Generating 1.000.000 solar systems (3 iterations).
* Chances for a 6 star solar system are fairly small.
* Only one solar system with 6 stars out of 3 million.
*
* #1st
* 1 Star : 732724
* 2 Stars: 234559
* 3 Stars: 30955
* 4 Stars: 1728
@immutef
immutef / php_navigation.php_r26001.diff
Created November 3, 2010 10:49
Developers Shame Day
Index: php/navigation.php
===================================================================
--- a/php/navigation.php
+++ b/php/navigation.php
@@ -2001,15 +2001,27 @@
}
-/********************************************************************************************
-* Function: getCountryURL *
-* Action: *
@immutef
immutef / SecurityController.php
Created October 27, 2010 09:58
Symfony2 Security Form Login
<?php // src/Application/UserBundle/Controller/SecurityController.php
namespace Application\UserBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller,
Symfony\Component\Security\SecurityContext;
class SecurityController extends Controller
{
public function loginAction()
@immutef
immutef / symfony2-pull-requests.md
Created October 25, 2010 19:10
HowTo: clean GitHub pull requests for Symfony2
  1. Fork Fabiens repository: http://github.com/fabpot/symfony.git

  2. Clone your fork and install/update vendors (I use my personal fork for now):

    git clone git@github.com:pminnieur/symfony.git symfony

    cd symfony && sh install_vendors.sh && sh update_vendors.sh

    phpunit

  3. Integrate Fabiens repository into your local clone:

@immutef
immutef / LoadGameData.php
Created October 16, 2010 18:50
Latest Symfony2 Fixtures for Doctrine2
<?php // src/Application/GameBundle/DataFixtures/ORM/LoadGameData.php
// cd src/vendor && git clone git://github.com/doctrine/data-fixtures doctrine-data-fixtures
// register the "Doctrine\Common\DataFixtures" namespace in your src/autoload.php file
namespace Application\GameBundle\DataFixtures\ORM;
use Doctrine\ORM\EntityManager,
Doctrine\Common\DataFixtures\FixtureInterface;