- array_map()
- Code style guide
- yield
- Fatal error: require(): Failed opening required '/var/www/html/partner-api/functions.php' (include_path='.:/usr/share/php') in /app/web/market-api/productimport/parserproduct.php on line 3
- Exception
- PSR4
- .htaccess
- Singleton или другой паттерн
- UPDATE geoname SET lng = 59.33384, lat = 30.27364 WHERE id = 37782;
- Dependency injection
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
#!/usr/bin/env bash | |
# Использование: | |
# | |
# 1. Установить GitHub Cli версии 2.5.2 или выше: https://github.com/cli/cli/releases | |
# 2. Авторизоваться: | |
# gh auth login | |
# 2.1. При создании токена для авторизации https://github.com/settings/tokens выдать права read и read:org | |
# 3. Создать папку для хранения репозиториев. | |
# 4. Зайти в неё. |
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
# | |
# .gitignore для сайтов на bitrix | |
# | |
# | |
# Файлы в репозитории должны храниться не все, а только некоторые. Основная цель: упростить процесс разработки. | |
# Для этого нужно: маленький репозиторий, который, тем не менее, включает в себя все нужное, и не чересчур | |
# сложный .gitignore. | |
# Небольшой размер репозитория ускоряет clone, коммиты и сборку для деплоя. Не очень сложный .gitignore | |
# упрощает его администрирование. |
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
// who is changing element in DOM? | |
const element = $0 | |
const callback = function () { | |
console.trace('here is who and how') | |
} | |
const observer = new MutationObserver(callback) |
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
#!/usr/bin/env bash | |
set -euo pipefail | |
function failExit() { | |
local msg="$1" | |
echo "FAIL: $msg" >&2 | |
exit 1 | |
} |
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
#!/usr/bin/env bash | |
BITRIX_WWW_DIR="$1" | |
[ -z "$BITRIX_WWW_DIR" ] && BITRIX_WWW_DIR="." | |
[ ! -d "$BITRIX_WWW_DIR" ] || [ ! -d "$BITRIX_WWW_DIR/bitrix" ] || [ ! -f "$BITRIX_WWW_DIR/index.php" ] || [ ! -d "$BITRIX_WWW_DIR/bitrix/php_interface" ] && { | |
if [ "$BITRIX_WWW_DIR" = "." ] ; then | |
echo " !! Bitrix not found in current directory." >&2 | |
else |
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
#!/usr/bin/env bash | |
# Creates .htaccess and .htpasswd in current directory to protect site with password | |
# Default login/password are dev/dev | |
[ -e .htaccess ] && { | |
echo " !! .htaccess already exists! Exiting." >&2 | |
exit 1 | |
} |
Midnight commander portable (mc portable) for Linux x86_64
.
If you do not have root on server, and there is no mc, but you need it, just download mc-portable.tar.gz from this gist, extract into user's home ~/ and enjoy.
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
Допустим, есть объект yii2 ActiveRecord, созданный как $model = new Model(). | |
А надо сохранить его в БД вместо существующей записи. | |
Казалось бы, $model->id = <существующий id> ; $model->save(), но нет. | |
Надо сделать подготовительную работу: | |
<?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
# fast and explore | |
SERVER=xxx | |
WWWROOT=/home/bitrix/www | |
# fast and explore | |
cd public_html | |
# первая часть exlude для ускорения на первом этапе, чтобы просто увидеть все, что скачается, и при необходимости |
NewerOlder