start new:
tmux
start new with session name:
tmux new -s myname
<?php | |
Collection::macro('maxBy', function ($callback) { | |
$callback = $this->valueRetriever($callback); | |
return $this->reduce(function ($result, $item) use ($callback) { | |
if ($result === null) { | |
return $item; | |
} | |
return $callback($item) > $callback($result) ? $item : $result; |
Here's a common predicament: you have a value, e.g., some string or number or struct, that can be read and written by many goroutines, and you want to make sure readers and writers don't collide -- that readers get the most recently written value, and no other, and that writers don't write the value while a reader is reading it.
You may have an idea in your head about how you would approach this problem, and your idea may be completely correct. But I want to try to level up your Go-fu
var ( | |
MaxWorker = os.Getenv("MAX_WORKERS") | |
MaxQueue = os.Getenv("MAX_QUEUE") | |
) | |
// Job represents the job to be run | |
type Job struct { | |
Payload Payload | |
} |
#!/bin/bash | |
echo "enter username : " | |
read username | |
echo "enter password: " | |
read -s password | |
echo "enter course: " | |
read course |
<?php | |
use PhpCsFixer\Config; | |
use PhpCsFixer\Finder; | |
$rules = [ | |
'array_indentation' => true, | |
'array_syntax' => ['syntax' => 'short'], | |
'binary_operator_spaces' => [ | |
'default' => 'single_space', |