Skip to content

Instantly share code, notes, and snippets.

@vboev
vboev / gist:1efc83c9ceecbb506ad55496c3358345
Created September 20, 2025 06:39
bitrix include file
<?$APPLICATION->IncludeFile(
SITE_TEMPLATE_PATH."/include/file.php",
Array(),
Array("MODE"=>"text", "NAME" => "Название при редактировании")
);?>
@vboev
vboev / regexps
Last active May 8, 2019 08:59
Регулярки для sublime
#убираем <p> из таблиц
<p>(.*)([\n]*[\t]*)+</p>
$1
#убираем <em> из таблиц
<em>(.*)([\n]*[\t]*)+</em>
$1
@vboev
vboev / optimimg.sh
Last active April 26, 2019 09:07
Оптимизация изображений рекрсивно в папке скрипта
!/bin/bash
find . -name "*.jpg" -exec convert -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -monitor -colorspace RGB {} {} \;
find . -name "*.jpeg" -exec convert -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -monitor -colorspace RGB {} {} \;
find . -name "*.gif" -exec convert -monitor -strip {} {} \;
find . -name "*.png" -exec convert -monitor -strip {} {} \;
find . -iname *.png -print0 |xargs -0 optipng -o5;
<td>[\n\r\t]+<p>(.+)[\n\r\t]+</p>[\n\r\t]+</td>
@vboev
vboev / http->https
Created February 5, 2019 06:50
301 redirect http - https
вариант 1
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
вариант 2
RewriteEngine On
@vboev
vboev / init.php
Created January 14, 2019 09:21
Битрикс Генерация title с номером страницы
<?
AddEventHandler("main", "OnEpilog", "OnEpilogHandler");
function OnEpilogHandler()
{
global $APPLICATION;
if (!defined('ERROR_404') && intval($_GET["PAGEN_1"]) > 0) {
$APPLICATION->SetPageProperty("title", $APPLICATION->GetPageProperty("title") . " - страница " . intval($_GET["PAGEN_1"]) );
}
}