Skip to content

Instantly share code, notes, and snippets.

this is how we can use jwt token & jwt token refresh to auth api calls.

  • first we have to use user username which is the default for both packages or it wont work, i couldnt find away to get it to work with email, specialy lexik/jwt-authentication-bundle

  • second we intercept requests to check if the jwt token has expired & if so we recreate new tokens and update request & response headers.

  • get current theme styles
// https://stackoverflow.com/questions/47117621/how-to-get-the-vscode-theme-color-in-vscode-extensions
const color = new vscode.ThemeColor('badge.background');
  • commands icons can use vscode builtin
"commands": [
    // ... ,
@ctf0
ctf0 / -laravel tips.md
Last active October 21, 2023 05:41
laravel tips
  • php assoc array to correct js array of objs
$data = [
    'Users' => 'abc',
    'posts' => 'blabla',
];

collect($data)->map(function ($v, $k) {
 return [
@ctf0
ctf0 / invisible recaptcha.md
Last active October 31, 2022 09:37
invisible recaptcha with vuejs & laravel

Frontend "https://github.com/DanSnow/vue-recaptcha"

  • npm install --save vue-recaptcha

  • form

<my-form inline-template>
    <form action="{{ route('...') }}" @submit.prevent="FormSubmit($event)">
        // other inputs
@ctf0
ctf0 / setup xdebug with vscode & docker.md
Last active April 26, 2022 12:13
docker php xdebug setup for vscode (insider)
  1. open terminal and run

    export XDEBUG_CONFIG="idekey=VSCODE"
  2. install xdebug for vscode

  3. add launch config

@ctf0
ctf0 / paginate.php
Last active October 20, 2021 01:05 — forked from vluzrmos/paginate.php
Laravel Paginate Collection or Array
<?php
// use Illuminate\Support\Collection;
// use Illuminate\Pagination\Paginator;
// use Illuminate\Pagination\LengthAwarePaginator;
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
  • we dont use @input to save changes as it will reset the cursor, so we use @blur instead
<td contenteditable dir="auto"
    v-html="someText"
    @keydown.enter.prevent
    @input="newEntry()"
    @blur="saveNewValue($event)">
</td>
<?php
namespace App;
use Closure;
class CommandEventsListener
{
protected $startCallbacks = [];
protected $finishCallbacks = [];