Skip to content

Instantly share code, notes, and snippets.

Guido Contreras Woda guiwoda

Block or report user

Report or block guiwoda

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
guiwoda /
Last active Dec 11, 2016
Brainstorming ORM


  • (Un)serialize from/to any source. Build an abstraction (Map) that could be implemented for SQL, NoSQL (Key-Value, Document...), JSON APIs, or anything that needs to build objects from scalar data.
  • Default to a table per entity, but allow views and multiple models from various data sources, even the ability to connect them (through events?).
// Write model: event sourcing?
class BookPublished(string $title, string $description, Author[] $authors, ...){}
class BookReviewed(Book $aBook, User $reviewer, string $review, int $rating){}
guiwoda /
Last active Jan 23, 2019
Run sonarqube analysis
if [ "$PULL_REQUEST_NUMBER" == "false" ]; then
~/sonar-scanner/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.analysis.mode=preview \
              -Dsonar.github.repository=$SEMAPHORE_REPO_SLUG \
              -Dsonar.github.oauth=$GITHUB_TOKEN \
~/sonar-scanner/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.analysis.mode=preview \

Keybase proof

I hereby claim:

  • I am guiwoda on github.
  • I am guiwoda ( on keybase.
  • I have a public key whose fingerprint is 6D3C A6D1 B9CB 3281 E4E1 90F5 A0D9 990F F73C AF3B

To claim this, I am signing this object:

guiwoda / IPDependentMiddleware.php
Created Sep 8, 2016
Wrap a middleware inside another
View IPDependentMiddleware.php
class IPDependentMiddleware {
private $wrapped;
public function __construct($wrapped){
$this->wrapped = $wrapped;
public function handle($request, $next)
guiwoda / AR_Cache_Repository.php
Last active Oct 17, 2018
AR (Eloquent) vs DM (Doctrine) gist
View AR_Cache_Repository.php
namespace App\ActiveRecord;
class PostRepository
private $cache;
public function __construct(Cache $cache)
// Any set() / get() cache implementation.
View EventStoreServiceProvider.php
namespace App\Providers;
use Doctrine\DBAL\Connection;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\ServiceProvider;
use Prooph\Common\Event\ActionEvent;
use Prooph\Common\Event\ActionEventEmitter;
use Prooph\Common\Event\ActionEventListenerAggregate;
use Prooph\Common\Event\DetachAggregateHandlers;
guiwoda / gist:d140d15cddf25a21eb9c
Created Jan 7, 2016
Verifying that +guiwoda is my blockchain ID.
View gist:d140d15cddf25a21eb9c
Verifying that +guiwoda is my blockchain ID.
guiwoda / second-level-cache.classes.php
Last active Aug 29, 2015
Invalidating association second level cache
View second-level-cache.classes.php
<?php namespace App\Entities;
* @Entity
* @Cache(usage="NONSTRICT_READ_WRITE")
class Post {
guiwoda / Money.php
Last active Aug 29, 2015
Simple interfaces to convert objects to scalar types and usage examples
View Money.php
// I left an example in the mailing list with a Money object
class Money implements CastsToString, CastsToFloat {
const DOLLARS = '$';
const POUND = '£';
const YEN = '¥';
private $currency;
private $amount;
guiwoda / FooRepository.php
Created Feb 13, 2015
Delegate creation responsibility to EM / Repos
View FooRepository.php
class FooRepository extends EntityRepository implements FooRepositoryInterface
public function startFooing($bar, $baz)
$em = $this->getEntityManager();
// Let's imagine we could
$foo = $em->create(Foo::class, [$bar, $baz]);
You can’t perform that action at this time.