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 / interceptors.js
Last active May 1, 2020 17:25
Axios interceptors with toast message using bootstrap vue
import Vue from 'vue'
export default http => {
// https://github.com/mzabriskie/axios#interceptors
http.interceptors.response.use(
response => response,
/**
* This is a central point to handle all
* error messages generated by HTTP
* requests
@jenky
jenky / .php_cs
Last active March 15, 2019 05:26
PHP CS fixer for Laravel
<?php
$finder = PhpCsFixer\Finder::create()
->exclude([
'bootstrap/cache',
'storage',
'vendor',
'public',
])
->in(__DIR__)
@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
@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 / 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 / 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 / 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 / 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 / AwsCognitoIdentitySRP.php
Last active October 7, 2024 13:17
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 / 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;