Skip to content

Instantly share code, notes, and snippets.

View cakper's full-sized avatar
🎯
Focusing

Kacper Gunia cakper

🎯
Focusing
View GitHub Profile
@cakper
cakper / composer.json
Created June 19, 2012 09:08
My composer.json
{
"require": {
"php": ">=5.3.2",
"symfony/symfony": ">=2.0.10,<2.1.0-dev",
"doctrine/orm": ">=2.1.0,<2.2.0-dev",
"twig/extensions": "*",
"symfony/assetic-bundle": "2.0.*",
"sensio/generator-bundle": "2.0.*",
"sensio/framework-extra-bundle": "2.0.*",
"sensio/distribution-bundle": "2.0.*",
@cakper
cakper / gist:3201592
Created July 29, 2012 20:09
Delete form
<?php
private function createDeleteForm($id)
{
return $this->createFormBuilder(array('id' => $id))
->add('id', 'hidden')
->getForm()
;
}
@cakper
cakper / KernelAwareTest.php
Created November 21, 2012 11:35 — forked from jakzal/KernelAwareTest.php
KernelAwareTest
<?php
require_once dirname(__DIR__).'/../../../../app/AppKernel.php';
/**
* Test case class helpful with Entity tests requiring the database interaction.
* For regular entity tests it's better to extend standard \PHPUnit_Framework_TestCase instead.
*/
abstract class KernelAwareTest extends \PHPUnit_Framework_TestCase
{
@cakper
cakper / Composer.json
Created November 27, 2012 11:00
Composer.json
{
"require": {
"symfony/console": "*",
"symfony/filesystem": "*"
},
"minimum-stability": "stable",
"autoload": {
"psr-0": {
@cakper
cakper / command.php
Created November 27, 2012 11:03
command.php
<?php
require_once __DIR__.'/vendor/autoload.php';
use Symfony\Component\Console\Application;
use Cakper\YourBundle\Command\YourCommand;
$application = new Application();
$application->add(new YourCommand);
$application->run();
<VirtualHost *:80>
   DocumentRoot /mnt/project/web
   RewriteEngine On
   RewriteCond %{DOCUMENT_ROOT}/$1 !-f
   RewriteRule ^/direcory/(.*)$ /direcory/app_dev.php [QSA,L,PT]
   Alias /direcory /mnt/project/web
@cakper
cakper / CommonContext.php
Last active December 17, 2015 17:09
Security Token Injection
<?php
/**
* @Given /^I am logged in as a "([^"]*)"$/
*/
public function iAmLoggedInAsA($role)
{
$firewall = 'secured_area';
$session = $this->getContainer()->get('session');
$user = $this->getUser();
@cakper
cakper / pre-commit
Created January 29, 2014 16:47
PHPSpec & PHPCsFixer pre commit hook
#!/bin/sh
if [ -f ./bin/phpspec ]
then
./bin/phpspec run --quiet
if [ $? -ne 0 ]
then
echo "PHPSpec has failed - commit aborted"
return 1
fi
@cakper
cakper / pre-commit
Created January 29, 2014 16:53
PHPSpec GIT pre-commit hook
#!/bin/sh
if [ -f ./bin/phpspec ]
then
./bin/phpspec run --quiet
if [ $? -ne 0 ]
then
echo "PHPSpec has failed - commit aborted"
return 1
fi
@cakper
cakper / Vagrantfile
Created February 17, 2014 17:25 — forked from jakzal/Vagrantfile
VAGRANTFILE_API_VERSION = "2"
digital_ocean_client_id = ''
digital_ocean_api_key = ''
Vagrant.require_plugin "vagrant-librarian-chef"
Vagrant.require_plugin "vagrant-omnibus"
Vagrant.require_plugin "vagrant-vbguest"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|