Skip to content

Instantly share code, notes, and snippets.

View cakper's full-sized avatar
🎯
Focusing

Kacper Gunia cakper

🎯
Focusing
View GitHub Profile
<?php
namespace Dcwroc\TaskBundle\Entity;
class Task
{
private $name;
private $dueDate;
private $completed = false;
@cakper
cakper / pre-commit.sh
Last active April 20, 2017 07:57
GIT pre-commit PHPSpec & PHP-CS-Fixer hook
#!/bin/sh
CWD=$(pwd)
STATUS=0
echo "Running PHPSpec and PHPCS"
if [ -f $CWD/bin/phpspec ]
then
$CWD/bin/phpspec run --quiet
@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|
@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 / 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 / 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();
<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 / 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();
@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 / 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
{