Skip to content

Instantly share code, notes, and snippets.


Jamie York ziadoz

View GitHub Profile
ziadoz / Dockerfile
Created Jan 10, 2023
Tideways PHP Extension on ARM64 Alpine Linux
View Dockerfile
FROM php:8.1-fpm-alpine
RUN wget "${TIDEWAYS_EXTENSION_VERSION}/tideways-php-${TIDEWAYS_EXTENSION_VERSION}-alpine-arm64.tar.gz" && \
tar xvzf tideways-php-${TIDEWAYS_EXTENSION_VERSION}-alpine-arm64.tar.gz && \
cp ./build/dist/tideways-php-alpine-${TIDEWAYS_PHP_VERSION}.so /usr/local/lib/php/extensions/no-debug-non-zts-${TIDEWAYS_PHP_EXTVER}/ && \
rm -rf tideways-php-${TIDEWAYS_EXTENSION_VERSION}-alpine-arm64.tar.gz ./build
ziadoz / AppServiceProvider.php
Created Dec 20, 2022
Replace Laravel Artisan Command Output With Custom Implementation
View AppServiceProvider.php
namespace App\Providers;
use App\YourCustomOutputStyle;
use Illuminate\Console\OutputStyle;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
ziadoz / refresh_tab.js
Last active Dec 8, 2022
Refresh Browser Tab At Specific Time
View refresh_tab.js
// Resources
// @see:
// @see:
// Paste this into the Web Inspector on the browser tab you want to refresh and hit Enter.
// Change this to the exact time you want to refresh the page at:
let then = new Date('2022-12-09 01:01:00');
window.setTimeout(() => window.location.reload(true), then.getTime() - new Date().getTime());
ziadoz / mysql8_indexed_json_arrays.sql
Created Dec 8, 2022
MySQL 8 - Search Indexed JSON Arrays
View mysql8_indexed_json_arrays.sql
-- DB Fiddle:
-- Create a customers table with an array JSON column containing their favourite numbers.
create table `customers` (
`id` bigint unsigned auto_increment,
`name` varchar(222),
`numbers` json not null,
primary key (`id`),
key `customers_numbers_index` ((cast(json_extract(`numbers`,_utf8mb4'$[*]') as unsigned array)))
) engine=InnoDB default charset=utf8mb4 collate=utf8mb4_unicode_ci;
ziadoz / s3-presigned-upload-sse.php
Last active Nov 24, 2022
AWS S3 Presigned Upload URL with SSE
View s3-presigned-upload-sse.php
// The X-Amz-Server-Side-Encryption header must be set in formInputs and options, with the correct case.
new PostObjectV4(
'key' => $key,
'acl' => 'private',
'X-Amz-Server-Side-Encryption' => 'AES256',
ziadoz /
Created Nov 19, 2022
Awesome Bot Docker Command
#!/usr/bin/env bash
docker run -ti --rm -v $PWD:/mnt dkhamsing/awesome_bot --allow-dupe --white-list,symfony,,,,,,
ziadoz / LaravelToSlimController.php
Created Oct 27, 2022
Convert Laravel 9 HTTP Requests to Slim 4
View LaravelToSlimController.php
use Illuminate\Foundation\Application;
use Illuminate\Http\Request as LaravelRequest;
use Illuminate\Http\Response as LaravelResponse;
use Slim\Factory\ServerRequestCreatorFactory;
use Slim\Http\Response as SlimResponse;
use Slim\Http\ServerRequest as SlimServerRequest;
class LaravelToSlimController
ziadoz / ExampleTest.php
Last active Oct 18, 2022
Refresh Database Using Specific Database Connection In Laravel Tests
View ExampleTest.php
namespace Tests\Feature;
use Tests\RefreshesDatabase;
class ExampleTest
use RefreshesDatabase;
public string $connectionToMigrate = 'mysql-elevated';
ziadoz / token.php
Created Oct 11, 2022
Generate Laravel Password Reset Token For Testing
View token.php
use Illuminate\Auth\Passwords\PasswordBroker;
$token = app()->get(PasswordBroker::class)->createToken(
User::query()->where('email', '=', '')->first()
ziadoz / .gitattributes
Last active Sep 26, 2022
Prevent Git Managing CSV Line Endings
View .gitattributes
# Prevent Git managing line endings of CSV files, otherwise it changes CRLF to LF on commit and checkout.
# This is useful if you're working with CSV files that come from legacy systems and have differing line endings.
# You can see view how Git manages line endings with this command: git ls-files --eol | grep .csv
# @see:
# @see:
# @see:
# @see:
# @see: