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 ValueToStatement | |
| public function valueToStatement(mixed $value): Node\Expr | |
| { | |
| return match (gettype($value)) { | |
| 'boolean' => new Node\Expr\ConstFetch(new Node\Name($value ? 'true' : 'false')), | |
| 'integer' => new Node\Scalar\Int_($value), | |
| 'double' => new Node\Scalar\Float_($value), | |
| 'string' => new Node\Scalar\String_($value), | |
| 'array' => new Node\Expr\Array_( |
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
| # For my kids and future setup | |
| winget install Oracle.JavaRuntimeEnvironment | |
| winget install Mojang.MinecraftLauncher | |
| # If you want to build any mods in the future | |
| # winget search java | |
| winget install Oracle.JDK.23 |
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
| /** | |
| * Crockford base32 encoding implementation (useable with random_bytes()) | |
| * see: https://www.crockford.com/base32.html. | |
| */ | |
| class CrockfordBase32 | |
| { | |
| const BITS_5_RIGHT = 31; | |
| const CHARS = '0123456789abcdefghjkmnpqrstvwxyz'; // lower-case |
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
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "IronPython", | |
| "type": "python", | |
| "request": "launch", | |
| "stopOnEntry": true, | |
| "pythonPath": "C:\\Program Files (x86)\\IronPython 2.7\\ipy.exe", | |
| "program": "${file}", |
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); | |
| namespace App\Providers; | |
| use Illuminate\Http\Client\Events\RequestSending; | |
| use Illuminate\Http\Client\Events\ResponseReceived; | |
| use Illuminate\Support\Facades\Event; |
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
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "Run ts-mocha File", | |
| "type": "node", | |
| "request": "launch", | |
| "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/ts-mocha", | |
| "runtimeArgs": [ | |
| "${file}" |
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
| require('ts-mocha'); | |
| const Mocha = require('mocha'); | |
| const fs = require('fs'); | |
| let testSubject = null; | |
| if (process.argv.length === 3) { | |
| testSubject = process.argv[2]; | |
| } | |
| const mocha = new Mocha({ timeout: 50000 }); |
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 | |
| public function writeQueryAsCsvFileToStorage() { | |
| $disk = Storage::disk('yourDiskNameHer'); | |
| // optional: ensure file doesn't exist: | |
| // $disk->delete($filePath); | |
| $cursor = $this->getQuery() | |
| ->toBase() // +-10x speed improvement, skip making laravel models | |
| ->cursor() // avoid loading whole result set into memory. | |
| ->map(fn ($item) => $this->map((array) $item)); |
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\Providers; | |
| use Illuminate\Support\Facades\Event; | |
| class EventServiceProvider extends ServiceProvider | |
| { | |
| /** |
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
| protected function putfile(string $path, string $content) | |
| { | |
| $host = config('services.sftp.host'); | |
| $port = config('services.sftp.port'); | |
| $con = ssh2_connect($host, $port, [], ['disconnect' => fn () => Log::debug('sftp disconeccted')]); | |
| if (false === $con) { | |
| throw new HttpException(503, 'sftp connection failed', ['sftpHost' => $host, 'sftpPort' => $port]); | |
| } | |
| if (false === ssh2_auth_password($con, config('services.sftp.username'), config('services.sftp.password'))) {\ | |
| ssh2_disconnect($con); |
NewerOlder