Skip to content

Instantly share code, notes, and snippets.

View jenky's full-sized avatar
✈️
fly away!

Lynh jenky

✈️
fly away!
  • 21.0228148,105.7957639
View GitHub Profile
@jenky
jenky / PassportAuthenticator.php
Created May 11, 2022 12:49
Laravel Compass Passport authenticator
<?php
namespace App\Support;
use Davidhsianturi\Compass\Authenticators\CredentialResult;
use Davidhsianturi\Compass\Authenticators\UserProvider;
use Davidhsianturi\Compass\Contracts\AuthenticatorRepository;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Cache;
@jenky
jenky / result.json
Created February 27, 2022 08:26
Company Tree
[
{
"id": "uuid-1",
"name": "Webprovise Corp",
"cost": 42389,
"children": [
{
"id": "uuid-2",
"name": "Stamm LLC",
"cost": 2587,
@jenky
jenky / MessageFormatter.php
Created December 31, 2021 10:57
Custom guzzle message formatter to remove binary image from log message
<?php
namespace App\Helpers;
use GuzzleHttp\MessageFormatter as Formatter;
use GuzzleHttp\Psr7\MultipartStream;
use Illuminate\Support\Str;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
@jenky
jenky / AwsCognitoIdentitySRP.php
Last active May 29, 2024 14:05
AWS Cognito Identity SRP authentication helper
<?php
use Aws\AwsClient;
use Aws\Result;
use Carbon\Carbon;
use phpseclib3\Math\BigInteger;
class AwsCognitoIdentitySRP
{
const N_HEX = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1'.
@jenky
jenky / GuzzleMessageFormatter.php
Created June 15, 2020 12:02
Guzzle custom MessageFormatter
<?php
namespace App\Logging;
use GuzzleHttp\MessageFormatter;
use Illuminate\Support\Arr;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
class GuzzleMessageFormatter extends MessageFormatter
@jenky
jenky / Flash.php
Last active April 6, 2020 11:09
Simple laravel flash message
<?php
namespace App\Support\Flash;
use Illuminate\Contracts\Session\Session;
use Illuminate\Support\Arr;
use Illuminate\Support\Traits\Macroable;
class Flash
{
@jenky
jenky / settings.json
Created January 9, 2020 07:48
VS Peacock colors
"peacock.favoriteColors": [
{
"name": "Angular Red",
"value": "#b52e31"
},
{
"name": "Auth0 Orange",
"value": "#eb5424"
},
{
@jenky
jenky / ExplodesFormRequestData.php
Created June 10, 2019 11:34
ExplodesFormRequestData trait
<?php
namespace App\Support\Traits;
use Illuminate\Support\Str;
trait ExplodesFormRequestData
{
/**
* Prepare the data for validation.
@jenky
jenky / Idempotency.php
Created May 7, 2019 05:30
Laravel idempotency middleware
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Cache;
class Idempotency
{
@jenky
jenky / patch.md
Created April 18, 2019 07:29
Git apply patch

Apply git patch

git apply --reject --whitespace=fix path/to/file.patch