Skip to content

Instantly share code, notes, and snippets.

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
// запрос данных
const getData = async (serverURI) => {
const data = await fetch(serverURI);
if (data.ok) {
return data.json();
} else {
throw new Error(`Данные не были получены, ошибка ${data.status} ${data.statusText}`);
}
// блокировка скролла
const disableScroll = () => {
if (document.disableScroll) { return; }
const widthScroll = window.innerWidth - document.body.offsetWidth;
document.disableScroll = true;
document.body.dbScrollY = window.scrollY;
@AndreySkryl
AndreySkryl / index.php
Created March 22, 2019 10:39
(Bitrix24) Установщик модуля
<?
use Asr\Telecom\Helpers\DB\IBlockInstaller;
use Asr\Telecom\Helpers\Logger;
use Asr\Telecom\Helpers\PublicPart\MenuHelper;
use Bitrix\Main\Application;
use Bitrix\Main\Config\Option;
use Bitrix\Main\IO\Directory;
use Bitrix\Main\IO\Path;
use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
@AndreySkryl
AndreySkryl / getIDsByGetElementList.php
Last active March 22, 2019 10:37
(Bitrix24) Получение id-ов через getElementList
<?
array_map(
function($element) { return $element["ID"]; },
$commonIBlock->getElementList(
[], ["=NAME" => ($element["<>"]) ?: false], false, false, ["ID"]
)
);
?>
@AndreySkryl
AndreySkryl / commoniblock.php
Created March 22, 2019 09:29
(Bitrix24) Класс-обёртка для работы с инфоблоками
<?
namespace Asr\Telecom;
use Asr\Telecom\Validators\ModuleDependencyValidator;
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
class CommonIBlock {
protected $IBLOCK_CODE;
@AndreySkryl
AndreySkryl / moduledependencyvalidator.php
Last active March 22, 2019 10:36
(Bitrix24) Класс "Валидатор зависимостей модуля"
<?
/**
* класс "Валидатор зависимостей модуля"
*/
class ModuleDependencyValidator {
/**
* Проверка зависимостей
* @param array $dependencies Массив зависимостей (модулей), необходимых для работы конкретного [класса, ...]
* @return bool $result Результат валидации
*