Install SleepWatcher using Homebrew:
sudo chown -R $(whoami) /usr/local
brew update
brew install sleepwatcher
Start the SleepWatcher service:
| <?php | |
| function feature(string $feature, callable $callable): void | |
| { | |
| group('Feature: ' . $feature, $callable); // Call Pest's group() method with the feature part of the Gherkin string. | |
| } | |
| function given(string $given) | |
| { | |
| return new class($given) implements Stringable { |
| <form action="." method="post"> | |
| <noscript>You must <a href="http://www.enable-javascript.com" target="_blank">enable JavaScript</a> in your web browser in order to pay via Stripe.</noscript> | |
| <input | |
| type="submit" | |
| value="Pay with Card" | |
| data-key="PUBLISHABLE STRIPE KEY" | |
| data-amount="500" | |
| data-currency="cad" | |
| data-name="Example Company Inc" |
| { | |
| "repositories": [ | |
| { | |
| "type": "path", | |
| "url": "../relative/project/path" | |
| } | |
| ], | |
| "require": { | |
| "${project}": "dev-${branch}" | |
| } |
Install SleepWatcher using Homebrew:
sudo chown -R $(whoami) /usr/local
brew update
brew install sleepwatcher
Start the SleepWatcher service:
| <?php | |
| declare(strict_types=1); | |
| // A PHP library like Pydantic settings where a config object maps automatically to env vars. | |
| // The object should be read-only. Super simple in scope. | |
| // Attributes: Env\String(), Int, Float, Bool, ArrayList, ArrayMap, Laravel Collection OptionsMap (list of allowed values) DSN, JSONMap, JSONArray, Nullable* Enums, Constants (e.g. PDO_* etc.). Default parameter. Prefixed, Fallback. Callable(fn () => ...) | |
| // Ability to read from $_ENV or getenv(). Need two "Reader" classes. Reader could handle PREFIX_ stuff more naturally. | |
| // EnvReader::set(new ServerEnvReader()), EnvReader::get() | |
| // new GetEnvReader(), new PrefixedEnvReader(new GetEnvReader()), new FallbackEnvReader(..., ...) | |
| // new DotEnvReader(), loads using dot env package, then reads from vars rather than set in $_ENV. |
| <?php | |
| foreach (get_loaded_extensions() as $extension) { | |
| echo "$extension: " . phpversion($extension) . "\n"; | |
| } |
| <?php | |
| class DownloadController extends Controller | |
| { | |
| public function download(Request $request): StreamedResponse | |
| { | |
| $filename = 'unique-filename.zip'; | |
| $checksum = base64_encode(hash('xxh128', $filename, true)); | |
| if (in_array($checksum, $request->getETags())) { |
| #!/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` |
| In the middle of a Zoom call my audio in/out devices changed to “Microsoft Teams Audio Devices”, despite no longer having Microsoft Teams installed. | |
| It turns out Teams leaves its audio driver on your system running, and it occasionally decides to make itself the default. | |
| I had to delete: /Library/Audio/Plug-Ins/HAL/MSTeamsAudioDevice.driver in the end to fix it: | |
| sudo rm -rf /Library/Audio/Plug-Ins/HAL/MSTeamsAudioDevice.driver | |
| https://forums.macrumors.com/threads/how-to-uninstall-core-audio-driver-msteamsaudiodevice-driver.2344450/ |
| <?php | |
| // Download Unicode database CSV: | |
| $ch = curl_init(); | |
| curl_setopt_array($ch, $options = [ | |
| CURLOPT_URL => 'https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt', | |
| CURLOPT_RETURNTRANSFER => true, | |
| CURLOPT_FOLLOWLOCATION => true, | |
| CURLOPT_TIMEOUT => 15, | |
| CURLOPT_FAILONERROR => true, |