View capitalize.js
This file contains 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
export const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1); |
View UniquelySuggable.php
This file contains 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\Models\Traits; | |
use Illuminate\Database\Eloquent\Model; | |
use Illuminate\Support\Str; | |
trait UniquelySuggable | |
{ | |
/** |
View regex-collection.js
This file contains 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
// Password validation | |
const length = 12, | |
pattern = `^(?=.*[a-zA-Z])(?=.*\\d)(?=.*[*!$€£#%&|_\\-@"'(§^¨{})\\[\\]´\`~+=:;,.?<>]).{${length},}$`, | |
regex = new RegExp(pattern); |
View array_commas.php
This file contains 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 | |
if (!function_exists('array_commas')) { | |
/** | |
* Split a comma separated string into an array. | |
* @param string $str | |
* @return array | |
*/ | |
function array_commas(string $str): array | |
{ | |
$str = explode(',', $str); |
View cast_boolean.php
This file contains 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 | |
if (!function_exists('cast_boolean')) { | |
/** | |
* Cast `'true'`, `'false'` etc. to bool. | |
* @param mixed $value | |
* @return bool | |
*/ | |
function cast_boolean($value): bool | |
{ | |
return filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); |
View checkbox-switch.css
This file contains 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
/* | |
Checkbox input as a switch | |
---------------------------------------------------------- */ | |
.switch { | |
--width: 60px; | |
--height: 34px; | |
--gutter: 4px; | |
--dot-width: calc(var(--height) - (var(--gutter) * 2)); | |
--dot-color: #fff; |
View php-custom-log.php
This file contains 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 | |
error_reporting(E_ALL); | |
ini_set('display_errors', 0); | |
ini_set('log_errors', 1); | |
ini_set('error_log', __DIR__ . '/logs/php-error.log'); |
View laravel-guzzle-response-cache.php
This file contains 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\Clients\Middleware; | |
use GuzzleHttp\Psr7\Response; | |
use Psr\Http\Message\RequestInterface; | |
use Psr\Http\Message\ResponseInterface; | |
use GuzzleHttp\Promise\PromiseInterface; | |
use GuzzleHttp\Promise\FulfilledPromise; | |
use Illuminate\Contracts\Cache\Repository; | |
/** |
View wp_terms_checklist_args_hierarchical.php
This file contains 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 | |
add_filter( 'wp_terms_checklist_args', function ( $args ) { | |
$args['checked_ontop'] = false; | |
return $args; | |
} ); |