Skip to content

Instantly share code, notes, and snippets.

View devoltt's full-sized avatar
💭
working

Batyrkhan devoltt

💭
working
View GitHub Profile
/*
* Код помещается в консоль браузера для отладки кастомных JS событий битрикс.
*/
BX.onCustomEvent = function(eventObject, eventName, arEventParams, secureParams) {
var result = {
'eventObject': eventObject,
'eventName': eventName,
'arEventParams': arEventParams,
'secureParams': secureParams
<IfModule headers_module>
Header set X-FRAME-OPTIONS "SAMEORIGIN"
Header set Content-Security-Policy "frame-ancestors 'self' https://example.com/"
</IfModule>
@devoltt
devoltt / cmd.sh
Created April 3, 2018 17:50
Linux commands
# Show files list, opened by process
ls -l /proc/<PROCESS ID>/fd
@devoltt
devoltt / init.php
Created May 18, 2018 11:26
Заглушка писем Bitrix24
<?
/*
* Add to /local/php_interface/init.php
*/
use Bitrix\Main\Diag\Debug;
function custom_mail($to, $subject, $message, $additional_headers, $additional_parameters) {
$fields = array(
@devoltt
devoltt / list.php
Created June 22, 2018 11:02
Список активных БП в Живой ленте Битрикс24
<?
## /bitrix/components/bitrix/socialnetwork.blog.post.edit/post.ajax.php 51 строка
function getBizprocList()
{
$lists = CIBlock::getList(
array("SORT" => "ASC","NAME" => "ASC"),
array("ACTIVE" => "Y","TYPE" => COption::GetOptionString("lists", "livefeed_iblock_type_id"), 'SITE_ID' => $siteId)
);
while($list = $lists->fetch())
@devoltt
devoltt / upload.sh
Created June 27, 2018 17:05
Зацикленная загрузка на сервер через rsync
while ! sshpass -p 'password' rsync --partial --append-verify --progress -a ./filemask* remoteuser@remotehost:/path/; do sleep 5; done
@devoltt
devoltt / settings.php
Created August 8, 2018 07:51
Получение личных настроек пользователя у вкладок CRM Bitrix24
<?
$userCrmTabSettingsTmp = get_object_vars(
json_decode(
\CUserOptions::GetOption(
'ui',
'crm_control_panel_menu',
'',
$userId
)['settings']
)
@devoltt
devoltt / pad.php
Created October 24, 2018 10:47
Popular regular expressions
<?
// Only letters, spaces and numbers
$str = preg_replace('/[^a-zа-яё\d\s]+/iu', '', $str);
@devoltt
devoltt / Mongo.php
Created March 11, 2019 10:23
Add autoincrement id in mongodb documents
/**
* Add autoincrement id
*
* @return bool|int|mixed
*/
public function autoincrement(){
if (!$this->collectionName()) {
return false;
}
@devoltt
devoltt / Mongo.php
Created March 11, 2019 10:24
Add timestamps created_at and updated_at on yii2 mongodb
/**
* Add timestamps on create and update records
*
* @return array
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::class,