Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Spomky's full-sized avatar
🚀
Stay hungry, stay foolish - SJ

Florent Morselli Spomky

🚀
Stay hungry, stay foolish - SJ
View GitHub Profile
@fbouchery
fbouchery / extract.php
Last active March 14, 2024 09:49
Extract phpstan baseline history count from GIT
<?php
$baselineFile = 'phpstan-baseline.neon';
$branch = 'origin/main';
echo "date;count\n";
foreach (explode("\n", `git log {$branch} --pretty="format:%H;%cI" --date-order --reverse {$baselineFile}`) as $line) {
[$hash, $date] = explode(';', $line);
preg_match_all('`^\s+count:\s+(\d+)`m', `git show $hash:{$baselineFile}`, $matches);
echo $date, ';', array_sum(array_map('intval', $matches[1])), "\n";
}
@lyrixx
lyrixx / test.php
Last active November 10, 2023 14:27
Symfony Playgound with its Container and a custom configuration
<?php
use App\Kernel;
require __DIR__.'/vendor/autoload_runtime.php';
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@DragonBe
DragonBe / auth-standard-requirements.md
Last active August 16, 2021 07:03
The common pattern for user registration, sign in, reset and removal of an account written out

Auth Stnadard Requirements

Problem statement

To tackle the common application pattern for authenticating, registering, resetting credentials, verifying, and unregistering from an application, the common patterns exists but many implementations make it hard to use the best solutions of different frameworks. While almost each application has this requirement, no standard has been defined.

Possible reasons why it's difficult

  • Too many backend solutions for storing and updating credentials (DB, LDAP/AD, API, SSO, SAML, …)
  • Added complexity when authorisation is required
  • Added complexity when MFA is required
@emlun
emlun / README.md
Last active February 20, 2020 15:19
DRAFT: WebAuthn recovery credentials extension
@soyuka
soyuka / OperationPathResolver.php
Created May 15, 2018 13:24
Workflow bridge for api platform
<?php
declare(strict_types=1);
namespace ApiPlatform\Workflow\PathResolver;
use ApiPlatform\Core\PathResolver\OperationPathResolverInterface;
final class OperationPathResolver implements OperationPathResolverInterface
{
@vktr
vktr / rule.js
Created February 10, 2018 18:54
Add Stripe Customer Id to Auth0 via custom rule
function (user, context, callback) {
user.app_metadata = user.app_metadata || {};
if ('stripe_customer_id' in user.app_metadata) {
context.idToken['https://example.com/stripe_customer_id'] = user.app_metadata.stripe_customer_id;
return callback(null, user, context);
}
var stripe = require('stripe')('sk_....');
var customer = {
@RomainMarecat
RomainMarecat / .gitlab-ci.sh
Last active April 25, 2022 03:56
Simple gitlab-ci configuration symfony
#!/bin/bash
# Install dependencies only for Docker.
[[ ! -e /.dockerinit ]] && exit 0
set -xe
# Update packages and install composer and PHP dependencies.
apt-get update -yqq
apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev phpunit -yqq
@kpobococ
kpobococ / function.rfc3986_validate_uri.php
Last active July 27, 2021 13:13
Regular Expression to validate URI (RFC 3986 http://tools.ietf.org/html/rfc3986)
<?php
function rfc3986_validate_uri($uri)
{
// Play around with this regexp online:
// http://regex101.com/r/hZ5gU9/1
// Links to relevant RFC documents:
// RFC 3986: http://tools.ietf.org/html/rfc3986 (URI scheme)
// RFC 2234: http://tools.ietf.org/html/rfc2234#section-6.1 (ABNF notation)
@ranacseruet
ranacseruet / VideoStream.php
Last active April 14, 2024 12:42
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@tPl0ch
tPl0ch / CommandContext.php
Last active August 18, 2023 11:18
A CommandContext for Behat tests of Symfony Console Commands
<?php
namespace MFB\Behat\Subcontext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\MinkExtension\Context\RawMinkContext;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\EventDispatcher\EventDispatcher;
/**