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 / 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|
<?php
namespace Dcwroc\TaskBundle\Entity;
class Task
{
private $name;
private $dueDate;
private $completed = false;
<?php
namespace Dcwroc\TaskBundle\Entity;
use Symfony\Component\Validator\Constraints as Assert;
class Task
{
/**
* @Assert\NotBlank()
<?php
namespace Dcwroc\TaskBundle\InMemory;
use Dcwroc\TaskBundle\Entity\Task;
use Dcwroc\TaskBundle\Entity\TaskRepository;
class InMemoryTaskRepository implements TaskRepository
{
/**
### Keybase proof
I hereby claim:
* I am cakper on github.
* I am cakper (https://keybase.io/cakper) on keybase.
* I have a public key whose fingerprint is E49A 7AB1 A55F 7052 DA92 89B2 363A FBB6 6B77 9714
To claim this, I am signing this object:
@cakper
cakper / Statistics.swift
Created March 3, 2015 12:58
Statistics
class Statistics {
let minimum: Int
let maximum: Int
let average: Int
init(minimum: Int, maximum: Int, average: Int) {
self.minimum = minimum
self.maximum = maximum
self.average = average
}
@cakper
cakper / Palindrome.php
Last active August 29, 2015 14:18
Palindrome
<?php
class ListElement
{
/**
* @var ListElement
*/
private $next;
private $value;
@cakper
cakper / KernelAwareTest.php
Created November 17, 2011 12:47 — 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 / gist:1385152
Created November 22, 2011 08:05
Test CreatedAt and Updated At
public function testThatCreateAndUpdateDatesAreRegisteredAndIdGenerated()
{
$this->prepareEntityManager();
$now = new \DateTime('now');
$moneyTransaction = $this->moneyTransaction;
$validator = $this->validator;
$recipient = new \Jazzy\UserBundle\Entity\User();