- 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 | |
# Скрипт по загрузке публичных файлов с Облака mail.ru. Поддерживается докачка. | |
# v1.0.5 от 2022-05-30 | |
# | |
# ЕСЛИ СКРИПТ НЕ РАБОТАЕТ | |
# | |
# 1. Убедитесь, что файл доступен публично. Возможна загрузка только публичных файлов. | |
# 2. Mail.ru время от времени меняет внутрянку, не очень сильно, но требуется адаптация скрипта. | |
# Если скрипт не работает, просьба сделать работающий форк и скинуть ссылку в комментарии. |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>Техническое обслуживание</title> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } |
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
#!/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 | |
# Использование: | |
# | |
# 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
AddDefaultCharset utf-8 | |
ErrorDocument 503 /maintenance.html | |
RewriteEngine On | |
RewriteBase / | |
# uncomment and set your ip to allow your ip to enter | |
#RewriteCond %{REMOTE_ADDR} !1\.2\.3\.4 | |
# block requests to site, but allow let's encypt generation |
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 | |
docker_host=$1 | |
if [ -z "$docker_host" ] ; then | |
echo "Syntax: `basename $0` <docker_host>" >&2 | |
exit 1 | |
fi | |
ssh localhost -R 127.0.0.1:35729:$docker_host:35729 |
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
#!/bin/sh | |
# Удаляем по 20 файлов в секунду. За 3 часа плавно удалим 200k файлов. | |
# Пригодится, когда нужно обновить кеш картинок на сайте, но нельзя удалить сразу весь кеш, | |
# потому что сайт ляжет из-за генерации новых картинок. | |
find ./ -type f | while sleep 1 ; do | |
CNT=0 | |
while read line ; do | |
CNT=$(($CNT + 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
// who is changing element in DOM? | |
const element = $0 | |
const callback = function () { | |
console.trace('here is who and how') | |
} | |
const observer = new MutationObserver(callback) |
NewerOlder