Skip to content

Instantly share code, notes, and snippets.

View drupol's full-sized avatar

Pol Dellaiera drupol

View GitHub Profile
@drupol
drupol / nix.tex
Created March 17, 2022 15:45
nix lstlisting
\lstdefinelanguage{nix}{
frame = single,
breaklines=true,
aboveskip=1ex,
backgroundcolor=\color{gray!25},
belowskip=1ex,
columns=fullflexible,
framerule=0pt,
framexrightmargin=0em,
framexleftmargin=0em,
@drupol
drupol / either.php
Last active November 26, 2021 09:26
<?php
declare(strict_types=1);
namespace App;
use Marcosh\LamPHPda\Either;
use Exception;
include __DIR__ . '/vendor/autoload.php';
@drupol
drupol / lyrixx.php
Last active November 25, 2021 21:31
<?php
/**
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Test;
@drupol
drupol / configuration.nix
Last active November 19, 2021 20:11
Nixos issue
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, lib, ... }:
{
imports =
[ # Include the results of the hardware scan.
@drupol
drupol / functional-anonymous-class.php
Last active October 24, 2021 17:17
Functional anonymous classes in PHP
<?php
/**
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace App;
@drupol
drupol / graphviz.md
Last active September 25, 2021 07:03
Embed GraphViz in Markdown files

Dot2Image

How to embed GraphViz in Markdown

image

More examples:

Use this image in your html page:

@drupol
drupol / dependency.svg
Last active August 17, 2021 09:05
Operations dependencies - see https://github.com/loophp/collection for more info
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
// Factorial of a number
printf("\nype a number: ")
&& ($g = (int) trim(fgets(STDIN))) && (fn(int $g, $y) =>
printf($y(static fn (callable $function) => static fn ($n = 1) => (1 >= $n) ? 1 : $n * $function($n - 1))($g))
)(
$g,
static fn (callable $g): callable => (static fn ($f): callable => $f($f))(static fn ($f): callable => $g(static fn ($x) => $f($f)($x)))
);
@drupol
drupol / test.php
Created March 10, 2021 19:47
Trying to decode a token with a ES256 signature.
<?php
namespace App;
use Facile\JoseVerifier\JWK\JwksProviderBuilder;
use Facile\JoseVerifier\JWTVerifier;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\Psr18Client;
include __DIR__ . '/vendor/autoload.php';
@drupol
drupol / primes.php
Last active December 30, 2020 17:56
Generating Prime Numbers with loophp/collection
<?php
declare(strict_types=1);
include __DIR__ . '/../vendor/autoload.php';
use loophp\collection\Collection;
$integers = Collection::unfold(static fn (int $n = 1): int => $n + 1);