Skip to content

Instantly share code, notes, and snippets.

View nicholasruunu's full-sized avatar

Nicholas Ruunu nicholasruunu

View GitHub Profile
final class DatabaseName implements Name {
private $db;
private $table;
public function __construct(Database $db, string $table) {
$this->db = $db;
$this->table = $table;
}
public function rename($name) {
<?php
namespace Memory\PlayingField;
use Memory\PlayingField;
final class IncompletePlayingField
{
private $cards = array();
private $numberOfCards = 0;
final class User
{
private $password;
public function changePassword($string)
{
$this->password = new Password($string);
}
}
@nicholasruunu
nicholasruunu / DomainEventProxy.php
Last active August 29, 2015 14:26
DomainEventProxy trait exmple
<?php
trait DomainEventProxy
{
private $eventMethodMapping = [];
private function callMappedMethod(DomainEvent $event, ...$arguments)
{
$method = $this->resolveMethod($event);
$this->$method($event, ...$arguments);
<?php
final class MonthNumber
{
private $number;
public function __construct(int $number)
{
$this->number = $number;
}
<?php
namespace Purist\Message;
use InvalidArgumentException;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\StreamInterface;
final class HttpMessage implements MessageInterface
{
<?php
declare(strict_types=1);
abstract class EventFactory
{
public function apply()
}
@nicholasruunu
nicholasruunu / FetchMembers.elm
Created October 13, 2016 13:49
Elm vs jQuery
module Main exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Json.Decode as Json exposing ((:=))
import Task
import Http
@nicholasruunu
nicholasruunu / NullFilter.php
Created February 21, 2017 15:19
Null filter for API-platform
<?php
namespace AppBundle\Api\Filter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
use Doctrine\ORM\QueryBuilder;
/**
* NullFilter for api-platform
Verifying that "nicholasruunu.id" is my Blockstack ID. https://onename.com/nicholasruunu