Skip to content

Instantly share code, notes, and snippets.

View iTeeLion's full-sized avatar
😎
Coding...

Sergey Abu iTeeLion

😎
Coding...
View GitHub Profile
@iTeeLion
iTeeLion / snippets_common.php
Last active May 4, 2023 07:11
PHP code snippents / Примеры самых используемых конструкций PHP
<?php
# Bitrix admin mode
if ($GLOBALS['USER']->IsAdmin()){
print '<pre>'.var_dump($val).'</pre>';
}
# Dev mode
if($_SERVER['REMOTE_ADDR'] == 'IP') {
print '<pre>'.var_dump($val).'</pre>';
@iTeeLion
iTeeLion / snippets_bitrix.php
Last active December 23, 2020 15:02
PHP snippets for bitrix / Примеры самых используемых конструкций в bitrix
<?php
/*
* Bitrix init (paths to header/prolog/footer)
*/
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/header.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/footer.php');
/*
@iTeeLion
iTeeLion / snippets_bitrixD7.php
Last active October 31, 2022 13:44
PHP snippets for bitrix D7 version / Примеры самых используемых конструкций в bitrix на D7
<?php
/*
* Bitrix init (paths to header/prolog/footer)
*/
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/header.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/footer.php');
/*
@iTeeLion
iTeeLion / snippets_bitrix24.php
Last active February 10, 2023 13:46
PHP snippets for bitrix24 / Примеры самых используемых конструкций для bitrix24
<?php
/*
* Snippert for CRM entities:
* Lead - //ToDo
* Deal - //ToDo
* Invoice - //ToDo
* Company - //ToDo
* Contact - //ToDo
* Requisites - //ToDo
@iTeeLion
iTeeLion / snippets_common.js
Last active December 23, 2020 14:50
JavaScript code snippets / Примеры самых используемых jquery конструкций
/*
* JQuery
*/
// document.on
$(document).on('click', '[data-element]', function(e){
e.preventDefault();
// some actions
});
@iTeeLion
iTeeLion / jquery_bx.js
Last active December 23, 2020 14:50
Bitrix custom jquery file tempate / Шаблон файла для js jquery скрипта в bitrix
var some_settings = [];
function init_main(){
}
$(function() {
init_main();
// bitrix "onAjaxSuccess" event listener
@iTeeLion
iTeeLion / phpstorm_theme_dracula_classic_ascii.icls
Last active December 23, 2020 14:49
PHPstorm dracula theme with default classic ASCII colors / Тема dracula для PHPstorm со стандартными классическими цветами ASCII
<scheme name="Darcula (Classic ASCII)" version="142" parent_scheme="Darcula">
<metaInfo>
<property name="created">2020-11-01T00:00:00</property>
<property name="ide">PhpStorm</property>
<property name="ideVersion">2020.2.3.0.0</property>
<property name="modified">2020-11-01T00:00:00</property>
<property name="originalScheme">Darcula (Classic ASCII)</property>
</metaInfo>
<colors>
<option name="CONSOLE_BACKGROUND_KEY" value="0" />
@iTeeLion
iTeeLion / linux.sh
Last active December 23, 2020 14:49
Linux basic web admin commands / Базовые команды администратора web сервера linux
# CentOS выбор основного редактора
export EDITOR=mcedit
#Grep:
grep -ilnr 'search' /indir --include=*.php
grep -ilnr 'search' /indir --exclude=*.php
grep -ilnr 'search' /indir --exclude-dir=cache
#CreateUser and Permissions:
useradd -s /bin/bash -d /home/iteelion -m -U -G user
@iTeeLion
iTeeLion / .htaccess
Last active May 21, 2022 19:58
.htaccess examples for redirect http to https and www to non www / Примеры .htaccess для редиректов с http на https и с www на nonwww
# Enable rewrite system (mail rules block) / Включить рерайты (блок для написания правил)
<IfModule mod_rewrite.c>
RewriteEngine On
... any other rewrite rules here...
</IfModule>
# Redirect nowww to www / Редирект без www поддомена, на сайт с www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=302,L]
@iTeeLion
iTeeLion / BitrixOptimizationClass.php
Last active December 23, 2020 14:47
Bitrix google pagespeed optimization class / PHP class для bitrix, вырезает все системные JS и CSS на которые жалуется google pagespeed
<?php
$eventManager = EventManager::getInstance();
$eventManager->addEventHandler('main', 'OnEndBufferContent', ['\\App\\Event\\Optimization', 'deleteKernelJs']);
$eventManager->addEventHandler('main', 'OnEndBufferContent', ['\\App\\Event\\Optimization', 'deleteKernelCss']);
/** class **/
namespace App\Event;