Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pix-art's full-sized avatar

Joeri Timmermans pix-art

View GitHub Profile
@pix-art
pix-art / TimeoutContext.php
Created July 28, 2017 07:04
A timeout context to help you when you have to wait for elements on your page
<?php
namespace FrontendBundle\Features\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Exception\ElementTextException;
use Behat\Mink\Exception\ResponseTextException;
use Behat\MinkExtension\Context\RawMinkContext;
class TimeoutContext extends RawMinkContext
1. Create cleanup.sh somewhere with the following code:
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
2. Create global alias for that file:
git config --global alias.cleanup '!sh <location of your file>/cleanup.sh'
3. Checkout to your develop or master and run:
$query = $this->em->getConnection()->createQueryBuilder()
->select('a.*')
->from('asset', 'a');
if ($type) {
$query->andWhere('a.type = :type')
->setParameter('type', $type);
}
$assets = $query->execute()->fetchAll();
@pix-art
pix-art / pre-commit
Created November 27, 2015 09:34
Pre commit hook that runs php-cs-fixer on your src folder (Symfony2)
#!/bin/sh
BASE=$(git rev-parse --show-toplevel)
php-cs-fixer self-update
php-cs-fixer fix $BASE/src/ --level=symfony
@pix-art
pix-art / FakerContext.php
Last active October 12, 2015 09:17
Custom faker context with extra logging on failure
<?php
namespace FrontendBundle\Features\Context;
use Behat\Behat\Hook\Scope\AfterScenarioScope;
use Behat\Gherkin\Node\TableNode;
use Behat\Symfony2Extension\Context\KernelAwareContext;
use Behat\Symfony2Extension\Context\KernelDictionary;
use Faker\Factory as FakerFactory;

##Open .inputrc

sudo vim ~/.inputrc

##Paste the following

"\e[A": history-search-backward
"\e[B": history-search-forward

##1. Setup docker

#Mac
https://docs.docker.com/installation/mac/

#Linux
https://docs.docker.com/installation/ubuntulinux/

##2. Setup docker-machine