Skip to content

Instantly share code, notes, and snippets.

create package.js

npm init -y

create tsconfig.json

tsc --init

install deps

@renaudtertrais
renaudtertrais / compose.js
Last active December 16, 2020 06:34
Simple ES6 compose & pipe function
const compose = (...fns) => (...args) => {
return fns.slice(0, -1).reduceRight((res, fn) => fn(res),
fns[fns.length -1].apply(null,args)
);
};
const pipe = (f1, ...fns) => (...args) => {
return fns.reduce((res, fn) => fn(res), f1.apply(null,args));
};
@jasonhofer
jasonhofer / simple-http-kernel.php
Last active July 21, 2021 17:22
A simplified version of the Symfony HttpKernel to help show what it does.
<?php
use Psr\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation as Http;
/**
* HttpKernel: "Get the response, and get out."
*
* As soon as the kernel gets its hands on a Response object, it says "I'm done" and returns it.
* It is only interested in finding a Response object, at which point it will call it a day.