Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font
To setup native Linux, see this gist
Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font
To setup native Linux, see this gist
| public function render($request, Throwable $exception) | |
| { | |
| if ($exception instanceof ModelNotFoundException) { | |
| $model = app($exception->getModel()); | |
| return \response()->json([ | |
| 'message' => method_exists($model, 'notFoundMessage') ? $model->notFoundMessage() : 'Resource not found', | |
| ], 404); | |
| } | |
| return parent::render($request, $exception); |
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the \ commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)| <?php | |
| $codes = [ | |
| 'ab' => 'Abkhazian', | |
| 'aa' => 'Afar', | |
| 'af' => 'Afrikaans', | |
| 'ak' => 'Akan', | |
| 'sq' => 'Albanian', | |
| 'am' => 'Amharic', | |
| 'ar' => 'Arabic', |
| # Add Audio Program type to GoldenDict | |
| bash -c "p=$(echo "%GDWORD%" |sed 's/ /+/g'); wget -q -U Mozilla -O - translate.google.com.vn/translate_tts?ie=UTF-8\&q=$p\&tl=en\&client=tw-ob | mpg123 -" |
#Branch Naming
Branches being created should have the following format:
<story type>/<story id>-<3-4 word story description>
#Example
chore/123-change-title
| function placeCaretAtEnd(el) { | |
| el.focus() | |
| if (typeof window.getSelection != "undefined" | |
| && typeof document.createRange != "undefined") { | |
| const range = document.createRange() | |
| range.selectNodeContents(el) | |
| range.collapse(false) | |
| const sel = window.getSelection() | |
| sel.removeAllRanges() | |
| sel.addRange(range) |
| /** | |
| * Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt(). | |
| * (c) Chris Veness MIT Licence | |
| * | |
| * @param {String} plaintext - Plaintext to be encrypted. | |
| * @param {String} password - Password to use to encrypt plaintext. | |
| * @returns {String} Encrypted ciphertext. | |
| * | |
| * @example | |
| * const ciphertext = await aesGcmEncrypt('my secret text', 'pw'); |
Getting started:
Related tutorials:
| <?php | |
| /** | |
| * Validates a given latitude $lat | |
| * | |
| * @param float|int|string $lat Latitude | |
| * @return bool `true` if $lat is valid, `false` if not | |
| */ | |
| function validateLatitude($lat) { | |
| return preg_match('/^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,6})?))$/', $lat); |