Skip to content

Instantly share code, notes, and snippets.

Avatar

Pol Dellaiera drupol

View GitHub Profile
@drupol
drupol / test2.php
Last active Mar 11, 2021
Trying to verify a token signed with ES256
View test2.php
<?php
namespace App;
use Facile\JoseVerifier\JWK\MemoryJwksProvider;
use Facile\JoseVerifier\JWTVerifier;
use Jose\Component\Core\AlgorithmManager;
use Jose\Component\KeyManagement\JWKFactory;
use Jose\Component\Signature\Algorithm\ES256;
use Jose\Component\Signature\Algorithm\PS256;
@drupol
drupol / test.php
Created Mar 10, 2021
Trying to decode a token with a ES256 signature.
View test.php
<?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 / cloudSettings
Last active May 3, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2021-05-03T09:10:16.993Z","extensionVersion":"v3.4.3"}
@drupol
drupol / OracleQuoteStrategy.php
Created Feb 12, 2021
Doctrine Oracle Quote Strategy
View OracleQuoteStrategy.php
<?php
declare(strict_types=1);
namespace App\Doctrine;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\QuoteStrategy;
View CasGuard.php
<?php
declare(strict_types=1);
namespace loophp\LaravelCas\Guards;
use EcPhp\CasLib\CasInterface;
use Illuminate\Auth\GuardHelpers;
use Illuminate\Auth\SessionGuard;
use Illuminate\Contracts\Auth\UserProvider;
@drupol
drupol / primes.php
Last active Dec 30, 2020
Generating Prime Numbers with loophp/collection
View primes.php
<?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);
View exitTheUs.php
<?php
declare(strict_types=1);
namespace App;
include __DIR__ . '/../vendor/autoload.php';
use loophp\collection\Collection;
@drupol
drupol / wallis.php
Last active Feb 25, 2021
Find Pi using Wallis formula
View wallis.php
<?php
/**
* Wallis formula
*
* 2 2 4 4 6 6 8 8
* pi = 2 x --- x --- x --- x --- x --- x --- x --- x --- x ...
* 1 3 3 5 5 7 7 9
*/
@drupol
drupol / stream-iterator.php
Last active Dec 9, 2020
Stream Iterator oddity
View stream-iterator.php
<?php
declare(strict_types=1);
namespace App;
use Generator;
use Iterator;
class ClosureIterator implements \Iterator
@drupol
drupol / SqliteForeignKeyEnabler.php
Created Dec 4, 2020
SqliteForeignKeyEnabler.php
View SqliteForeignKeyEnabler.php
<?php
declare(strict_types=1);
namespace App\Doctrine;
use Doctrine\Common\EventSubscriber;
use Doctrine\DBAL\Events;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\PreFlushEventArgs;