Skip to content

Instantly share code, notes, and snippets.

View iampersistent's full-sized avatar

Rich Shank iampersistent

View GitHub Profile
<?php
/**
* The problem
* -----------
* People start to build Symfony2 Bundles which need a database.
* Instead of having ORM-only Bundles and ODM-only Bundles,
* people try to make Bundles more generic, for obvious reasons.
*
* A proposition
@weaverryan
weaverryan / Basic Twig
Created October 28, 2010 23:39
Here's a small victory for a Twig noob
<div id="breadcrumbs">
{% for breadcrumb in breadcrumbs %}
{% if not loop.last %}
{{ breadcrumb | raw }} {{ breadcrumbs.separator | raw }}
{% else %}
<strong>{{ breadcrumb.label }}</strong>
{% endif %}
{% endfor %}
</div>
<?php
class Tag
{
public function normalizeName($name)
{
$normal = trim($name);
$normal = strtolower($normal);
return $normal;
<?php
/**
* @mongodb:Document
*/
class Band
{
/**
* @mongodb:Field(type="string")
* @var string
Parameters:
forum.repository.topic.class
forum.controller.topic.class
forum.form.topic.class
Serices:
forum.repository.topic
forum.controller.topic
@schmittjoh
schmittjoh / AjaxFailureHandler.php
Created June 12, 2011 09:48
Twitter Anywhere Authentication
<?php
namespace Security\Authentication;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
class AjaxFailureHandler implements AuthenticationFailureHandlerInterface
@beberlei
beberlei / MyWebTestCase.php
Created September 17, 2011 12:14
Easily Inject authenticated Symfony User into functional test
<?php
use Liip\FunctionalTestBundle\Test\WebTestCase;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @group functional
*/
@loonies
loonies / 1_phpunit-api.md
Last active January 19, 2024 07:34
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
@ziadoz
ziadoz / awesome-php.md
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@inspiran
inspiran / pricing.twig
Created February 7, 2012 23:20
Vespolina pricing declaration based on twig alike syntax
{% pricingSet "packable_product" %}
{% element "packaging_cost" %}
{% element "net_value" %}
{% element "net_value_with_packaging_cost" %}
{% element "tax_amount" %}
{% element "unit_price_with_tax" %}
{% endpricingset %}
{% pricingSet "cart_item" %}
{% element "total_discount" %}