Skip to content

Instantly share code, notes, and snippets.

View marat-dimaev's full-sized avatar

Marat Dimaev marat-dimaev

View GitHub Profile
@marat-dimaev
marat-dimaev / readme.md
Created January 11, 2020 19:55 — forked from slava-vishnyakov/readme.md
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@marat-dimaev
marat-dimaev / bx_iblock_element_prop_display.php
Created August 7, 2016 20:40
Bitrix вывод значений свойств элемента инфоблока
\Bitrix\Main\Loader::includeModule('iblock');
$res = \CIBlockElement::GetList(
array(),
array('ID'=>$id,'ACTIVE'=>'Y','IBLOCK_ID'=>self::$IBLOCK_ID),
false,
array('nTopCount'=>1),
array("ID", "IBLOCK_ID", 'NAME','PREVIEW_PICTURE','DETAIL_PICTURE','PREVIEW_TEXT','PROPERTY_*')
);
if($res->SelectedRowsCount()) {
@marat-dimaev
marat-dimaev / recaptcha.php
Created February 5, 2016 08:25
reCaptcha
<?
/*
reCaptcha представляет собой бесплатный сервис, который защищает ваш сайт от спама и злоупотреблений.
// Подключение
<?=reCaptcha::getHtml();?>
// Проверка
if(!reCaptcha::check()) {
global $APPLICATION;
@marat-dimaev
marat-dimaev / BXarrFilters.php
Last active January 26, 2016 08:21
Bitrix arrFilters
$arFilter = array();
// Фильтр по дате активности
$arFilter["<=DATE_ACTIVE_FROM"] = ConvertTimeStamp(time(),'FULL');
// Логический фильтр
$logic = array("LOGIC" => "OR");
foreach ($periods as $period) {
$time = ($NowTime-(86400*$period['days']));
$logic[] = array("<=DATE_ACTIVE_FROM"=>ConvertTimeStamp($time,'FULL'),'PROPERTY_21'=>$period['value_id']);