Skip to content

Instantly share code, notes, and snippets.

View norberttech's full-sized avatar

Norbert Orzechowicz norberttech

View GitHub Profile
@norberttech
norberttech / AcmeDemoExtension.php
Last active December 19, 2015 11:49
How to write specs for Symfony2 bundle extension.
<?php
namespace Acme\DemoBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
class AcmeDemoExtension extends Extension
@norberttech
norberttech / AbstractCreateForm.php
Created June 6, 2013 10:23
PageObject Element created by parameters.
<?php
namespace FSi\Bundle\DemoBundle\Behat\Page\Element;
use SensioLabs\Behat\PageObjectExtension\PageObject\Element;
use SensioLabs\Behat\PageObjectExtension\PageObject\Exception\UnexpectedPageException;
/**
* @author Norbert Orzechowicz <norbert@fsi.pl>
*/
@norberttech
norberttech / Datetime2Type.php
Created March 13, 2013 09:37
Doctrine DateTime2 mapping problem. (MSSQL server will accept it if there will be 3 digits only after dot)
<?php
namespace FSi\Bundle\DemoBundle\Doctrine\DBAL\Types;
use Doctrine\DBAL\Types\VarDateTimeType;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
class Datetime2Type extends VarDateTimeType
{
@norberttech
norberttech / placeholder.js
Created January 14, 2013 20:46
Placeholder.js fast usage.
window.onload = function() {
var form = document.getElementById('form'),
placeholderTestElm = document.createElement('input'),
isSupported = !(undefined === placeholderTestElm.placeholder);
if (!isSupported) {
this.initPlaceholder();
form.onsubmit = function(e) {
alert('After this point all inputs without values and with placeholder should be clear.');