View .go
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/md5" | |
"crypto/rand" | |
"fmt" | |
"io" | |
) | |
func main() { |
View gist:680fee72f384478e1cfa9fe81428e73a
One of the useful features of Laravel Horizon is its ability to gracefully shutdown, that means it'll wait for any running jobs to finish before the processes are terminated. | |
However, in order to really guarantee that your jobs won't be interrupted you need to make sure of the following: | |
1. Your Horizon supervisors' timeout value is greater than the number of seconds consumed by the longest running job. | |
2. Your job-specific timeout is shorter than the timeout value of the Horizon supervisor. | |
3. If you're using Supervisor to monitor the Horizon process, make sure the value of stopwaitsecs is greater than the number of seconds consumed by the longest running job. | |
With this correctly configured, Supervisor will wait for the Horizon process to terminate and won't force-terminate it after stopwaitsecs passes. |
View Merge two files line by line
paste -d " " file1.txt file2.txt > merged.txt |
View gist:5b99022a2e56ecef4ca8f67c7f8248b0
<<<<<<<<<<PHP | |
if (preg_match('/Basic+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) { | |
list( | |
$_SERVER['PHP_AUTH_USER'], | |
$_SERVER['PHP_AUTH_PW'] | |
) = explode(':', base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6))); | |
} | |
<<<<<<<<<<Apache | |
<IfModule mod_rewrite.c> |
View xdebug-docker-phpstorm
1. xdebug.ini | |
xdebug.remote_enable = 1 | |
xdebug.remote_autostart = 0 | |
error_reporting = E_ALL | |
display_startup_errors = 1 | |
display_errors = 1 | |
2. docker-compose.yml | |
environment: | |
XDEBUG_CONFIG: "remote_host=192.168.1.44 remote_enable=1" |
View gist:a36917689dc9af53b9e4be4dc3a2a62c
SET FOREIGN_KEY_CHECKS = 0; | |
SET UNIQUE_CHECKS = 0; | |
DROP TABLE brand; | |
DROP TABLE category; | |
DROP TABLE photo; | |
DROP TABLE product; | |
SET FOREIGN_KEY_CHECKS = 1; | |
SET UNIQUE_CHECKS = 1; |
View bash
В течении сессии терминала: | |
1. С помощью алиасов | |
alias phpunit="php ~/.composer/vendor/bin/phpunit" | |
unalais phpunit | |
2. В переменную $PATH | |
export PATH="$PATH:~/.composer/vendor/bin" | |
Навсегда: | |
Аналогично прописать в ~/.bashrc |
View cache
Если будет проблема с правами на cache | |
Почистить runtime. Права должны быть www:ample |
View main.php
'debug' => [ | |
'class' => 'yii\debug\Module', | |
'allowedIPs' => ['46.160.150.46'] | |
] |
View product.php
<?= $activeForm->field($offerForm, 'color') | |
->label(false) | |
->error(false) | |
->dropDownList(OfferHelper::colorsByProduct($product), [ | |
'onchange' => " | |
$.post( | |
'".Url::to(["shop/catalog/update-sizes"])."', | |
{product_id: {$product->id}, color: $(this).val()}, | |
function(data){ | |
if (!$.isEmptyObject(data)){ |
NewerOlder