Skip to content

Instantly share code, notes, and snippets.

Nicholas Ruunu nicholasruunu

View GitHub Profile
View gist:ed2a6acfb64b6fb0741fe08e4bf6b786
/**
* @throws AdressApiDown
*/
public function validate($value, Constraint $constraint): void
{
try {
if ($someService->checkValue($value)) {
$this->context
->buildViolation($constraint->message)
->addViolation();
View gist:5e101ff8990bc3fcf124f030621603f7
FROM frolvlad/alpine-python3
RUN apk add --update make gcc git python3-dev musl-dev libffi-dev openssl-dev py-pip
RUN pip install -r requirements.txt
COPY . /app
WORKDIR /app
ENTRYPOINT pytest config-test/ -s --env=
// Run with
// docker run <container> $TEST_ENV
View gist:ee11cff4fa9082b6eddb1d44a6b05061
Verifying that "nicholasruunu.id" is my Blockstack ID. https://onename.com/nicholasruunu
@nicholasruunu
nicholasruunu / NullFilter.php
Created Feb 21, 2017
Null filter for API-platform
View NullFilter.php
<?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
View FetchMembers.elm
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
View EventFactory.php
<?php
declare(strict_types=1);
abstract class EventFactory
{
public function apply()
}
View HttpMessage.php
<?php
namespace Purist\Message;
use InvalidArgumentException;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\StreamInterface;
final class HttpMessage implements MessageInterface
{
View month.php
<?php
final class MonthNumber
{
private $number;
public function __construct(int $number)
{
$this->number = $number;
}
@nicholasruunu
nicholasruunu / DomainEventProxy.php
Last active Aug 29, 2015
DomainEventProxy trait exmple
View DomainEventProxy.php
<?php
trait DomainEventProxy
{
private $eventMethodMapping = [];
private function callMappedMethod(DomainEvent $event, ...$arguments)
{
$method = $this->resolveMethod($event);
$this->$method($event, ...$arguments);
View gist:99ffee180d47adc0d8bf
final class User
{
private $password;
public function changePassword($string)
{
$this->password = new Password($string);
}
}
You can’t perform that action at this time.