Skip to content

Instantly share code, notes, and snippets.

View cherifGsoul's full-sized avatar
🎯
Focusing

Cherif Bouchelaghem cherifGsoul

🎯
Focusing
View GitHub Profile
@cherifGsoul
cherifGsoul / DDD, CQRS & ES.md
Created February 25, 2017 19:27 — forked from rasheedamir/DDD, CQRS & ES.md
DDD, CQRS & ES!

To implement command processing we need the following pieces:

  • Commands which request that something should happen, i.e. some state change
  • Events which indicate that something has happened
  • Aggregates that handles Commands and generates Events based on the current state
  • Event store which stores all events that has happened
  • Application services that receives Commands and routes it to the appropriate aggregate

https://github.com/rasheedamir/event-sourcing-in-practice

@cherifGsoul
cherifGsoul / index.php
Created December 25, 2016 20:01 — forked from tuupola/index.php
Use JWT Authentication middleware with ZF Expressive
<?php
use Zend\Expressive\AppFactory;
use Firebase\JWT\JWT;
use Slim\Middleware\JwtAuthentication;
chdir(dirname(__DIR__));
require "vendor/autoload.php";
$app = AppFactory::create();
@cherifGsoul
cherifGsoul / Container.php
Last active January 3, 2017 18:35
Yii2 container decorated with container-interop
<?php
namespace app\components;
use Interop\Container\ContainerInterface;
class Container implements ContainerInterface
{
private $wrappedContainer;
function __construct($container)
@cherifGsoul
cherifGsoul / JavascriptCodeReusePattern
Created September 11, 2016 16:35 — forked from JAzzNoTE/JavascriptCodeReusePattern
Javascript Code Reuse Patterns
----------
### Object Creation Patterns
#### Module & Revelation Pattern
Module pattern can define private properties.
It includes several patterns:
@cherifGsoul
cherifGsoul / behat-reference.feature
Created August 14, 2016 16:24 — forked from mnapoli/behat-reference.feature
Behat Mink reference
# Given
Given I am on [the] homepage
Given I am on "url"
# When
When I go to [the] homepage
When I go to "url"
When I reload the page
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);
@cherifGsoul
cherifGsoul / repo_pattern.py
Created June 14, 2016 14:29 — forked from uris77/repo_pattern.py
Example of Repository Pattern with SQLAlchemy
# This is a very crud example of using the Repository Pattern with SQLAlchemy. It allows me to completely ignore interactions with
# the database. This is only pulled in whenever I require to persist or retrieve an object from the database. The domain/business
# logic is entirely separated from persistence and I can have true unit tests for those.
# The tests for persistence are then limited to very specific cases of persistence and retrieving instances, and I can do those
# independent of the business logic. They also tend to be less tests since I only need to test them once.
@cherifGsoul
cherifGsoul / Db.php
Last active July 27, 2016 22:43
Proof of concept and example how to implement facades for yii2 components
<?php
namespace app\components\facades;
/**
* Example how to use the facade class
* uses yii\db\Connection
*/
class Db extends Facade
{
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id="main">
</div>