Skip to content

Instantly share code, notes, and snippets.

View felixcarpena's full-sized avatar

Félix felixcarpena

View GitHub Profile

Rohlik BDD workshop

You will find here a simple Cart + Discount models which we will use to explore and implement BDD with cucumber.

We are going to iterate the solution through several steps. For each step we have created a branch called stepX where X represents the number of the step. If at any point you feel lost or want to check our proposed solution, consult the code there.

Setup

@felixcarpena
felixcarpena / pre-push.sh
Last active March 2, 2018 08:52
git hook pre-push to have a double check before push to master
#!/bin/bash
#extracted from https://dev.ghost.org/prevent-master-push/
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
echo
@felixcarpena
felixcarpena / Runner.php
Created October 24, 2016 19:24
Refactor after include Guzzle
<?php
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Psr7\Request;
include 'classes/cron_display.php';
final class Runner
{
private $cron;
@felixcarpena
felixcarpena / GildedRose.php
Created October 18, 2016 07:52
gilded rose - php - step before polymorphism
<?php
namespace GildedRose;
class GildedRose
{
private $items;
function __construct($items)
@felixcarpena
felixcarpena / create_ramdisk_mysql.sh
Created July 11, 2016 00:19
run mysql on ramdisk for mac os and mysql 5.7
#!/bin/bash
#original script from: http://kotega.com/blog/2010/apr/12/mysql-ramdisk-osx/
diskutil erasevolume HFS+ 'Ramdisk' `hdiutil attach -nomount ram://2097152`
/usr/local/Library/LinkedKegs/mysql/bin/mysqld --initialize-insecure \
--user=visca \
--datadir=/Volumes/Ramdisk \
--basedir=/usr/local/Library/LinkedKegs/mysql \
@felixcarpena
felixcarpena / Dockerfile
Created July 10, 2016 14:35
Dockerfile from php 5-fpm with some usually used extensions
FROM php:5-fpm
RUN apt-get update \
&& apt-get install -y git \
&& apt-get install -y libmemcached-dev && apt-get install -y zlib1g-dev && pecl install memcached && docker-php-ext-enable memcached \
&& apt-get install -y libmagickwand-dev && pecl install imagick && docker-php-ext-enable imagick \
&& docker-php-ext-install bcmath \
&& docker-php-ext-install opcache \
&& docker-php-ext-install -j$(nproc) pdo_mysql \
&& apt-get install -y libicu-dev && pecl install intl && docker-php-ext-enable intl \
&& apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev \
@felixcarpena
felixcarpena / CommandTimeOptionEventListener.php
Created June 28, 2016 17:31
Symfony ConsoleEvents: Create a Listener that add a "--time" global option to all commands and print the start/end time
<?php
//app.console_event_listener:
// class: AppBundle\Listener\CommandTimeOptionEventListener
// tags:
// - { name: kernel.event_listener, event: console.command, method: onConsoleCommand }
// - { name: kernel.event_listener, event: console.terminate, method: onConsoleTerminate }
namespace AppBundle\Listener;