Skip to content

Instantly share code, notes, and snippets.

Sébastien Nikolaou sebdesign

Block or report user

Report or block sebdesign

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
View AppServiceProvider.php
# app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\Carbon;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@sebdesign
sebdesign / OutputBuffer.php
Created Oct 2, 2017
Testing ZlibOutputStream
View OutputBuffer.php
<?php
namespace Amp\ByteStream;
use Amp\Promise;
class OutputBuffer implements OutputStream, Promise {
private $contents;
/** @var \Throwable Used to fail future writes on failure. */
@sebdesign
sebdesign / collection-invoke.php
Last active Nov 7, 2016
Collection macro for invoking methods on (nested) items
View collection-invoke.php
<?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
<?php
class Color
{
/**
* Convert a hex color to RGB.
*
* @param string $hex #BADA55
* @return array [186, 218, 85]
*/
View curry.php
<?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()));
};
}
You can’t perform that action at this time.