Skip to content

Instantly share code, notes, and snippets.


Sébastien Nikolaou sebdesign

View GitHub Profile
sebdesign / CollectionContains.php
Created Jan 15, 2021
View CollectionContains.php
namespace Tests;
use Illuminate\Database\Eloquent\Model;
use PHPUnit\Framework\Constraint\Constraint;
* Constraint that asserts that the Collection it is applied to contains
* a given value.
View AppServiceProvider.php
# app/Providers/AppServiceProvider.php
namespace App\Providers;
use Illuminate\Support\Carbon;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
sebdesign / OutputBuffer.php
Created Oct 2, 2017
Testing ZlibOutputStream
View OutputBuffer.php
namespace Amp\ByteStream;
use Amp\Promise;
class OutputBuffer implements OutputStream, Promise {
private $contents;
/** @var \Throwable Used to fail future writes on failure. */
sebdesign / collection-invoke.php
Last active Nov 7, 2016
Collection macro for invoking methods on (nested) items
View collection-invoke.php
use Illuminate\Support\Collection;
* Invoke the method each (nested) item of the collection, returning the result of each invoked method.
* @var string $method The method or the path of the method separated with @.
* @var mixed $arguments,... Any optional arguments to pass to the invoked method.
* @return static
View Color.php
class Color
* Convert a hex color to RGB.
* @param string $hex #BADA55
* @return array [186, 218, 85]
View curry.php
function curry(callable $function)
$args = array_slice(func_get_args(), 1);
return function() use ($function, $args) {
return call_user_func_array($function, array_merge($args, func_get_args()));