Skip to content

Instantly share code, notes, and snippets.

View guiwoda's full-sized avatar

Guido Contreras Woda guiwoda

View GitHub Profile
@guiwoda
guiwoda / gist:d140d15cddf25a21eb9c
Created January 7, 2016 00:13
Verifying that +guiwoda is my blockchain ID. https://onename.com/guiwoda
Verifying that +guiwoda is my blockchain ID. https://onename.com/guiwoda
@guiwoda
guiwoda / EventStoreServiceProvider.php
Created January 22, 2016 20:44
Event store and Laravel
<?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
guiwoda / AR_Cache_Repository.php
Last active February 25, 2023 21:11
AR (Eloquent) vs DM (Doctrine) gist
<?php
namespace App\ActiveRecord;
class PostRepository
{
private $cache;
public function __construct(Cache $cache)
{
// Any set() / get() cache implementation.
@guiwoda
guiwoda / IPDependentMiddleware.php
Created September 8, 2016 23:59
Wrap a middleware inside another
<?php
class IPDependentMiddleware {
private $wrapped;
public function __construct($wrapped){
$this->wrapped = $wrapped;
}
public function handle($request, $next)
{
@guiwoda
guiwoda / keybase.md
Created September 19, 2016 19:53
keybase.md

Keybase proof

I hereby claim:

  • I am guiwoda on github.
  • I am guiwoda (https://keybase.io/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
guiwoda / sonar.sh
Last active January 23, 2019 14:47
Run sonarqube analysis
#!/bin/bash
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 \
              -Dsonar.host.url=$SONAR_HOST_URL \
              -Dsonar.login=$SONAR_TOKEN
else
~/sonar-scanner/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.analysis.mode=preview \
@guiwoda
guiwoda / 01-wishlist.md
Last active December 11, 2016 20:11
Brainstorming ORM

Wishlist

  • (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){}