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
// slicePutAt is an efficient insertion function that avoid unnecessary allocations | |
func slicePutAt[V any](dst []V, pos int, v V) []V { | |
dst = append(dst, v) // could grow here | |
copy(dst[pos+1:], dst[pos:]) | |
dst[pos] = v | |
return dst | |
} | |
// sliceFilterInPlace does not allocate | |
func sliceFilterInPlace[T any](input []T, filter func(elem T) bool) []T { |
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 | |
declare(strict_types=1); | |
namespace notes; | |
/** | |
* ObservabilityClient can throw upon instantiation, but sending does not block. | |
*/ | |
class ObservabilityClient |
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 | |
/** | |
* Emoji detects unicode emojis based on: | |
* "Unicode Emoji" https://www.unicode.org/reports/tr51/ | |
* @see emoji sequences: https://unicode.org/Public/emoji/latest/emoji-sequences.txt | |
* @see emoji sequences: https://unicode.org/Public/emoji/latest/emoji-zwj-sequences.txt | |
*/ | |
class Emoji | |
{ |
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 MysqlCollection implements CollectionInterface | |
{ | |
// .. other stuff | |
/** @var CacheInterface */ | |
private $cache; | |
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 VideoPublisher\Foundation\Exception; | |
/** | |
* This trait will add message translation to any exception. | |
* The goal of this is to support every exception with string problem code and possible message | |
*/ | |
trait KnownProblem | |
{ | |
/** @var string code to look up in documentation like "112_EMAIL_INVALID" */ |
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 | |
// When I create a validation rule, I can set my one replacer which helps replace different special placeholders | |
// For example if validator message is "Problem with :some", then my replacer will handle it | |
Validator::extend('testrule', function($attribute, $value, $parameters, $validator) { | |
$validator->addReplacer('testrule', function($message, $attribute, $rule, $parameters){ | |
return str_replace(":some", "whatever", $message); | |
}); |
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
SELECT * FROM `table` WHERE BINARY `column` = 'value' |
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
public function rules() | |
{ | |
$user = User::find($this->users); | |
switch($this->method()) | |
{ | |
case 'GET': | |
case 'DELETE': | |
{ | |
return []; |
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
URL?ZRayDisable=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
So I am facing an Issue - how do I run dedicated Vagrant Virtual Machine with Homestead Box in it? | |
https://docs.vagrantup.com/ shows how to run the box. But what about settings? | |
So I did: | |
vagrant init in folder | |
then installed Homstead via | |
composer require laravel/homestead --dev | |
php vendor/bin/homestead make | |
Then edited Homestead.yaml | |
and then did vagrant reload --provision so changes took effect |