Skip to content

Instantly share code, notes, and snippets.

@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.');
@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 / 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 / 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 / vagrant_submodules
Created October 30, 2013 11:55
Vagrant submodules
git submodule add http://github.com/example42/puppet-apache vagrant/modules/apache
git submodule add http://github.com/puppetlabs/puppetlabs-java vagrant/modules/java
git submodule add https://github.com/puppetlabs/puppetlabs-apt.git vagrant/modules/apt
git submodule add https://github.com/vagrantee/puppet-composer.git vagrant/modules/composer
git submodule add https://github.com/puppetlabs/puppetlabs-mysql.git vagrant/modules/mysql
git submodule add https://github.com/example42/puppet-php.git vagrant/modules/php
git submodule add https://github.com/puphpet/puppet-puphpet.git vagrant/modules/puphpet
git submodule add https://github.com/example42/puppi.git vagrant/modules/puppi
git submodule add https://github.com/puppetlabs/puppetlabs-stdlib.git vagrant/modules/stdlib
git submodule add https://github.com/puphpet/puphpet-xdebug.git vagrant/modules/xdebug
@norberttech
norberttech / selenium-travis.yml
Last active December 28, 2015 02:39
Symfony2 Behat Selenium at travis. Remeber to change domain "example.com"
language: php
php:
- 5.3
- 5.4
- 5.5
before_install:
- sudo apt-get update > /dev/null
$object = new \Object();
$object->name = 'norbert';
$object->surname = 'orzechowicz';
$object->email = 'norbert@orzechowicz.pl';
$objectPreview($object);
$objectPreview->addField('name', array('propertyPath' => 'name', 'label' => 'User Name'));
$objectPreview->addField('surname', array('propertyPath' => 'surname', 'label' => 'User Surname'));
$objectPreview->addField('email', array('propertyPath' => 'email', 'label' => 'Email'));
@norberttech
norberttech / FeatureContext.php
Created February 17, 2014 20:26
Check scenario tags
<?php
namespace FSi\Bundle\AdminBundle\Behat\Context;
use Behat\Behat\Context\BehatContext;
use Behat\Behat\Event\ScenarioEvent;
class FeatureContext extends BehatContext
{
/**
<?php
$users = mysql_query(<<<EOT
SELECT `users`.`id`
FROM `users`
WHERE `users`.`regkey` = ''
ORDER BY `users`.`id` DESC
LIMIT 1
<<EOT);
- name: Install Mysql package
apt: name={{ item }} state=installed
with_items:
- mysql-server
- python-mysqldb
- python-selinux