Skip to content

Instantly share code, notes, and snippets.

View yoelpc4's full-sized avatar
🚀
Make something out of nothing

Yoel Peter Chandra yoelpc4

🚀
Make something out of nothing
View GitHub Profile
@yoelpc4
yoelpc4 / sql-debug.php
Created September 27, 2020 20:52
Laravel SQL Debug
\DB::listen(function (\Illuminate\Database\Events\QueryExecuted $query) {
$sql = $query->sql;
$bindings = implode(', ', $query->bindings);
$time = $query->time;
\Log::info("\nSQL: {$sql}\nBindings: {$bindings}\nTime: {$time}\n\n");
});
@yoelpc4
yoelpc4 / Procfile
Last active November 25, 2021 14:48
Laravel Heroku Configuration
web: vendor/bin/heroku-php-nginx -C nginx.conf public/
supervisor: supervisord -c supervisor.conf -n
@yoelpc4
yoelpc4 / database.php
Last active April 5, 2021 10:32
Laravel Query Builder Cursor Method with MySQL Connection solution (based on https://github.com/laravel/framework/issues/14919)
'mysql_unbuffered' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)