Skip to content

Instantly share code, notes, and snippets.

@tabbi89
tabbi89 / ansible-bootstrap-ubuntu-16.04.yml
Created December 11, 2016 16:37 — forked from gwillem/ansible-bootstrap-ubuntu-16.04.yml
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@tabbi89
tabbi89 / AppKernel.php
Created October 1, 2015 18:13 — forked from kbond/AppKernel.php
JWT Authentication With Symfony Guard. POST username/password to /login to receive token, /api* requests require a valid token
<?php
// app/AppKernel.php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
public function registerBundles()
{
@tabbi89
tabbi89 / config.yml
Created September 25, 2015 06:16 — forked from K-Phoen/config.yml
Storing Symfony2 sessions in memcached
imports:
# ....
- { resource: services/session.yml }
framework:
# ....
session:
handler_id: session.handler.memcached
@tabbi89
tabbi89 / ApiKeyAuthenticationServiceProvider.php
Last active September 6, 2015 22:02 — forked from kwisatz/ApiKeyAuthenticationServiceProvider.php
Silex ApiKeyAuthenticationServiceProvider
<?php
/**
* ApiKeyAuthenticator for the Symfony Security Component
*/
namespace Ttf\Security\Provider;
use Silex\Application,
Silex\ServiceProviderInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException,
Symfony\Component\Security\Core\Authentication\Provider\SimpleAuthenticationProvider,

DDD, CQRS and Event Sourcing

In preparation for a new gig I'm reading up on the terms Domain-Driven Design, Command-Query Responsibility Segregation, and Event Sourcing. Here are a list of useful texts and talks that I've discovered so far. If anything is missing please leave a comment.

DDD

@tabbi89
tabbi89 / CQRS.php
Last active August 29, 2015 14:19 — forked from raykolbe/CQRS.php
<?php
namespace CQRSSample\Domain\Model
{
/**
* Please read this. It may be interesting to you. You can ridicule me ONLY if you read the whole thing.
*
* CQRS is NOT about different data sources and is NOT about Event Sourcing.
* CQRS IS about breaking out your reads and writes. It's powerful and simple!
sf2-ddd
├── app
├── bin
├── build
├── lib
├── src
│   └── __VendorPrefix
│   ├── Application
│   │   └── __DomainNameBundle
│   │   ├── Command
@tabbi89
tabbi89 / silex_http_auth_before_exceptions.php
Last active January 3, 2016 12:29
Silex Framework - BASIC Auth before all exceptions, when user attempt to access route that does not exist (and all responses must be secured by Basic AUTH)
<?php
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel;
use Silex\Application;
// app ...
$app = new Application();
@tabbi89
tabbi89 / dependency_injection.php
Last active December 28, 2015 05:59
Dependency Injection PHP
<?php
// Constructor
interface IDependency
{
public function action();
}
class Depndency implements IDpendency
@tabbi89
tabbi89 / gist:7453279
Created November 13, 2013 17:48
MVC PHP pattern
<?php
abstract class AModel
{
}
class Model extends AModel
{
public function __construct()