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
| <div id="app"></div> | |
| <script> | |
| const option = document.createElement('option'); | |
| option.value = 'Foo Bar'; | |
| const datalist = document.createElement('datalist'); | |
| datalist.id = 'foo-bar'; | |
| datalist.appendChild(option); |
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\Exceptions; | |
| use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | |
| use Throwable; | |
| class Handler extends ExceptionHandler | |
| { | |
| public function register(): void |
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 | |
| screencapture -R$(osascript -e 'tell app "Google Chrome" to get the bounds of the front window' | tr -d '[:space:]') -C -o -x -k -v ~/Desktop/chrome.mov |
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 | |
| # @see: https://www.jetbrains.com/help/phpstorm/working-with-the-ide-features-from-command-line.html | |
| # @see: https://www.jetbrains.com/help/phpstorm/comparing-files-and-folders.html#comparing_folders | |
| # Usage: phpstorm diff [a] [b] | |
| # View > Compare With | |
| open -na "PhpStorm.app" --args "$@" |
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 | |
| # Slugify a string | |
| # @see: https://duncanlock.net/blog/2021/06/15/good-simple-bash-slugify-function/ | |
| # @see: https://gist.github.com/oneohthree/f528c7ae1e701ad990e6 | |
| function slugify() { | |
| iconv -t ascii//TRANSLIT \ | |
| | tr -d "'" \ | |
| | sed -E 's/[^a-zA-Z0-9]+/-/g' \ | |
| | sed -E 's/^-+|-+$//g' \ |
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 | |
| // @see: https://stackoverflow.com/questions/21861825/quick-way-to-find-the-largest-array-in-a-multidimensional-array | |
| $array = [ | |
| ['foo', 'bar'], | |
| ['foo'], | |
| ['foo', 'bar', 'baz'], | |
| ]; | |
| echo count(max($array)) . PHP_EOL; | |
| echo count(min($array)) . PHP_EOL; |
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 Tests; | |
| use Laravel\Dusk\Browser; | |
| trait FakesJavaScriptFetch | |
| { | |
| // Usage: $browser->script($this->fakeFetchResponse(['foo' => 'bar'])); | |
| public function fakeFetchResponse(array $data): string | |
| { |
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 Example | |
| { | |
| // By default the attribute binds a getter to `getName()`and setter to `setName()`. | |
| #[Accessor] | |
| protected string $name; | |
| // Custom getter and setter method names can be passed. | |
| #[Accessor(getter: 'customGetter, setter: 'customSetter')] | |
| protected string $name; |
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\Http\Middleware; | |
| use Closure; | |
| use Illuminate\Http\Request; | |
| use Symfony\Component\HttpFoundation\Response; | |
| use Symfony\Component\HttpKernel\Exception\HttpException; | |
| class PreventMaxInputVarTruncation |
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
| <a href="#">I am a link.</a> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const a = document.querySelector('a'); | |
| ['load', 'click'].forEach((type) => { | |
| a.addEventListener(type, (event) => { | |
| event.preventDefault(); | |
| console.log(event.type); | |
| }); |