Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<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); |
<?php | |
/** | |
* The __halt_compiler() function will stop the PHP compiler when called. | |
* You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt. | |
* In this example a PHP template is stored after the halt, to allow simple separation of logic from templating. | |
* The template is stored in a temporary file so it can be included and parsed. | |
* | |
* See: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php | |
* http://php.net/manual/en/function.halt-compiler.php | |
*/ |
#!/usr/bin/env bash | |
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
# Versions | |
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE` |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
namespace App\Exceptions; | |
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | |
use Throwable; | |
class Handler extends ExceptionHandler | |
{ | |
public function register(): void |
#!/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 |
#!/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 "$@" |
#!/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' \ |
Install SleepWatcher using Homebrew:
sudo chown -R $(whoami) /usr/local
brew update
brew install sleepwatcher
Start the SleepWatcher service:
<?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; |