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 InterNACHI\Msfh\Tests\Feature\Admin; | |
| class Maze | |
| { | |
| protected const array DIRECTIONS = [ | |
| [1, 0], // Right | |
| [-1, 0], // Left | |
| [0, 1], // Down |
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 | |
| # Move into project root using git | |
| REPO_ROOT=$(git rev-parse --show-toplevel) | |
| cd "$REPO_ROOT" || exit | |
| # Configuration | |
| INCLUDE_COMMIT_HISTORY=true | |
| COMMIT_HISTORY_COUNT=5 | |
| FAIL_ON_ERROR=false # Set to true to exit with error code for debugging |
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
| @props([ | |
| 'src', | |
| 'title' => null, | |
| 'alt' => null, | |
| ]) | |
| @php | |
| preg_match('/.*\/embed\/([^?&\/]+)/m', $src, $matches); | |
| $id = $matches[1]; | |
| $alt ??= $title ?? 'Embedded YouTube video'; |
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
| (function() { | |
| (function() { | |
| console.log('Hello') | |
| })() | |
| (function() { | |
| console.log('World!') | |
| })() | |
| })() |
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
| composer-link() { | |
| jq '.repositories |= [{"type": "path", "url": "'$1'", "options": {"symlink": true}}] + . ' composer.json > composer.tmp.json && mv composer.tmp.json composer.json | |
| packageName=$(jq -r '.name' $1/composer.json) | |
| composer require $packageName @dev | |
| } | |
| composer-unlink() { | |
| git checkout composer.json composer.lock |
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
| #!/bin/bash | |
| now=$(date +%s) | |
| two_years_in_seconds=$((2 * 365 * 24 * 60 * 60)) | |
| cutoff_date=$((now - two_years_in_seconds)) | |
| git for-each-ref --format '%(authordate:iso) %(refname)' refs/heads | while read line; do | |
| authordate="${line%% refs/heads/*}" | |
| authordate_unix=$(date -j -f "%Y-%m-%d %H:%M:%S %z" "$authordate" +%s) | |
| refname="${line##* refs/heads/}" |
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 | |
| function str_inflect(string $value, Countable|int|float $count = null, bool $format = false, bool $spellout = false): string | |
| { | |
| preg_match('/^(?:(?<verb>is(?: an?)?|are)\s+)?(?:(?<count>\d+(?:[,.]\d+)?)\s+)?(?<value>.*)/m', $value, $matches); | |
| // Get rid of any commas in the input value | |
| $matches['count'] = str_replace(',', '', $matches['count']); | |
| // This is used for pluralization, but whatever input was provided |
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
| Alpine.directive('typed', (el, { expression, modifiers }, { evaluateLater, effect, cleanup }) => { | |
| const getStrings = evaluateLater(expression); | |
| const modifierValue = (key, fallback) => { | |
| if (-1 === modifiers.indexOf(key)) { | |
| return fallback; | |
| } | |
| const value = modifiers[modifiers.indexOf(key) + 1]; | |
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 DemoTest extends DatabaseTestCase | |
| { | |
| use TestsMoney; | |
| use TestsStripeWebhooks; | |
| use MocksAuthorizeNet; | |
| protected User $owner; | |
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 | |
| \Illuminate\Support\Str::macro('extremeSnake', function($value, $delimiter = '_') { | |
| $pattern = <<<'REGEXP' | |
| / | |
| (?<!^) # don't match the beginning of a string | |
| ( | |
| (?<=[^\p{Lu}])[\p{Lu}\p{M}]+(?=\p{M}?[^\p{Ll}]\p{M}?\p{L}) # string of upper-case (like an abbreviation) | |
| | (?<=\p{Lu}{2})[\p{Lu}\p{M}](?=\p{M}?\p{Ll}) # the final upper-case in a sequence | |
| | (?<=[^\p{Lu}])[\p{Lu}\p{M}](?=\p{M}?\p{Ll}) # first upper-case in a capitalized sequence |
NewerOlder