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 | |
declare(strict_types=1); | |
namespace App\Providers; | |
use GuzzleHttp\Middleware; | |
use GuzzleHttp\Promise\PromiseInterface; | |
use Illuminate\Http\Client\PendingRequest; | |
use Illuminate\Support\Facades\Http; |
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 | |
public function callableToCode(mixed $callable): ?string | |
{ | |
if (is_string($callable) && str_contains($callable, '@')) { | |
$callable = explode('@', $callable); | |
} | |
if (is_array($callable) && count($callable) === 2) { | |
[$class, $method] = $callable; | |
$instance = app($class); |
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\Providers; | |
use App\CustomClipboard; | |
use Illuminate\Cache\ArrayStore; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ |
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 GuzzleHttp\Psr7\Utils; | |
use Illuminate\Support\Facades\Http; | |
$stream = Http::withOptions(['stream' => true]) | |
->get('https://example.com') | |
->toPsrResponse() | |
->getBody(); | |
while ($line = Utils::readLine($stream)) { |
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 Tests; | |
use Artisan; | |
use Illuminate\Foundation\Testing\RefreshDatabase; | |
use Illuminate\Foundation\Testing\RefreshDatabaseState; | |
use Illuminate\Support\Str; | |
trait LazilyRefreshDatabaseIfNecessary |
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 Deployer; | |
require_once __DIR__.'/vendor/deployer/deployer/recipe/common.php'; | |
add('recipes', ['laravel']); | |
//set('shared_dirs', ['storage']); | |
set('shared_files', ['.env']); |
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\Providers; | |
use GuzzleHttp\Middleware; | |
use Illuminate\Support\Facades\Http; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ |
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 | |
class AnsiText implements \Stringable | |
{ | |
public const BLACK = 30; | |
public const RED = 31; | |
public const GREEN = 32; | |
public const YELLOW = 33; | |
public const BLUE = 34; | |
public const MAGENTA = 35; |
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
#!/usr/bin/env sh | |
runuser -u sail -- php "$@" | |
# 1. Copy or mount this script into the laravel.test container. | |
# 2. Setup your remote PHP interpreter in PhpStorm to use the script as "PHP Executable" |
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 detectHorizontalOverflow = (root) => { | |
root = root || document; | |
const { offsetWidth } = document.documentElement; | |
let previousOverflowing = null; | |
let overflowingCount = 0; | |
root.querySelectorAll('*').forEach((el) => { | |
const { right } = el.getBoundingClientRect(); | |
if (right > offsetWidth) { | |
// Ignore the children of overflowing elements. The issue is probably their parents. | |
if (previousOverflowing === null || !previousOverflowing.contains(el)) { |
NewerOlder