This file contains hidden or 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\Models; | |
| // use Illuminate\Contracts\Auth\MustVerifyEmail; | |
| use Illuminate\Database\Eloquent\Factories\HasFactory; | |
| use Illuminate\Foundation\Auth\User as Authenticatable; | |
| use Illuminate\Notifications\Notifiable; | |
| use Spatie\Image\Enums\Fit; | |
| use Spatie\MediaLibrary\HasMedia; |
This file contains hidden or 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 | |
| function feature(string $feature, callable $callable): void | |
| { | |
| group('Feature: ' . $feature, $callable); // Call Pest's group() method with the feature part of the Gherkin string. | |
| } | |
| function given(string $given) | |
| { | |
| return new class($given) implements Stringable { |
This file contains hidden or 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 | |
| foreach (get_loaded_extensions() as $extension) { | |
| echo "$extension: " . phpversion($extension) . "\n"; | |
| } |
This file contains hidden or 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 | |
| class DownloadController extends Controller | |
| { | |
| public function download(Request $request): StreamedResponse | |
| { | |
| $filename = 'unique-filename.zip'; | |
| $checksum = base64_encode(hash('xxh128', $filename, true)); | |
| if (in_array($checksum, $request->getETags())) { |
This file contains hidden or 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 | |
| declare(strict_types=1); | |
| // A PHP library like Pydantic settings where a config object maps automatically to env vars. | |
| // The object should be read-only. Super simple in scope. | |
| // Attributes: Env\String(), Int, Float, Bool, ArrayList, ArrayMap, Laravel Collection OptionsMap (list of allowed values) DSN, JSONMap, JSONArray, Nullable* Enums, Constants (e.g. PDO_* etc.). Default parameter. Prefixed, Fallback. Callable(fn () => ...) | |
| // Ability to read from $_ENV or getenv(). Need two "Reader" classes. Reader could handle PREFIX_ stuff more naturally. | |
| // EnvReader::set(new ServerEnvReader()), EnvReader::get() | |
| // new GetEnvReader(), new PrefixedEnvReader(new GetEnvReader()), new FallbackEnvReader(..., ...) | |
| // new DotEnvReader(), loads using dot env package, then reads from vars rather than set in $_ENV. |
This file contains hidden or 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 | |
| // Download Unicode database CSV: | |
| $ch = curl_init(); | |
| curl_setopt_array($ch, $options = [ | |
| CURLOPT_URL => 'https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt', | |
| CURLOPT_RETURNTRANSFER => true, | |
| CURLOPT_FOLLOWLOCATION => true, | |
| CURLOPT_TIMEOUT => 15, | |
| CURLOPT_FAILONERROR => true, |
This file contains hidden or 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 | |
| // A rubbish AI-generated logger output class: | |
| namespace App\Console\Output; | |
| use Illuminate\Support\Facades\Log; | |
| use Psr\Log\LoggerInterface; | |
| use Symfony\Component\Console\Formatter\OutputFormatter; | |
| use Symfony\Component\Console\Formatter\OutputFormatterInterface; | |
| use Symfony\Component\Console\Output\Output; |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| DEBUG=pw:protocol DEBUG_FILE=logs.txt ./node_modules/.bin/playwright run-server --host [HOST] --port [PORT] --mode launchServer |
This file contains hidden or 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 | |
| // In a Terminal tab run: | |
| // > php artisan scratch && php artisan queue:work --queue=test | |
| // | |
| // In a new Terminal tab run: | |
| // > kill -[NUM] $(pidof -s php artisan queue:work) | |
| // | |
| // Results: | |
| // -2 (SIGINT) = Job continues looping. |
This file contains hidden or 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
| services: | |
| minio: | |
| image: minio/minio:latest | |
| restart: always | |
| hostname: minio | |
| ports: | |
| - "9000:9000" | |
| - "9001:9002" | |
| environment: | |
| MINIO_ROOT_USER: minio |
NewerOlder