This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Execute the given function and set the given ref to true while it is busy executing | |
*/ | |
export function trackState(stateRef, fn) { | |
stateRef.value = true | |
return Promise.resolve(fn()) | |
.finally(() => stateRef.value = false) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My notes for upgrading laragon to work with latest apache and php8.1 | |
Update to laragon 5: | |
- Stop all running services in laragon | |
- Make sure laragon itself is properly closed | |
- Download the latest laragon.exe and overwrite your original laragon.exe | |
https://github.com/leokhoa/laragon/releases/download/5.0.0/laragon.exe | |
Update to latest apache | |
- Download the latest apache 2.4 VS16 for windows (Apache 2.4.x OpenSSL 1.1.1 VS16): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using postgres ltree module to build an automatic materialised path from a parent_id field | |
// Useful for parent-child database structures where you need to query for non-immediate descendants or ancestors | |
DB::statement("CREATE EXTENSION IF NOT EXISTS pg_trgm"); // for additional index types | |
DB::statement("CREATE EXTENSION IF NOT EXISTS ltree"); // to build a materialised path with | |
// Helper function for fetching a materialised path of the given table and ID | |
// Assumes the parent fkey is parent_id | |
$sql = <<<'SQL' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const EXIF_ROTATION_0 = 1; | |
const EXIF_MIRROR_0 = 2; | |
const EXIF_ROTATION_90 = 6; | |
const EXIF_MIRROR_90 = 5; | |
const EXIF_ROTATION_180 = 3; | |
const EXIF_MIRROR_180 = 4; | |
const EXIF_ROTATION_270 = 8; | |
const EXIF_MIRROR_270 = 7; | |
const GIF_TYPE = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Password; | |
# Generate a token in the same style as laravels password reset tokens. | |
# Will generate something like: 785f616c4978a87ad65a899ed4133b358a4697649c55b0965a7ebb7486bd9801 | |
/** @var DatabaseTokenRepository */ | |
$repo = Password::getRepository(); | |
$token = $repo->createNewToken($user); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
/** | |
* Reads the current version of the app into an APP_VERSION variable by reading | |
* the applications Node JS package.json file. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
/** | |
* This middleware allows us to correctly hotlink to pages from within MS apps. | |
* | |
* It fixes the issue where clicking a link to a page from within MS app (excel/word etc) fails due to the MS app |