Skip to content

Instantly share code, notes, and snippets.

View alexstep's full-sized avatar

kellas alexstep

View GitHub Profile
@alexstep
alexstep / bx_secs_tree.php
Created October 4, 2012 10:27
bitrix: sections tree
/* Получаем и кешируем информацию о разделах(sections) */
// должен быть подключен CModule::IncludeModule("iblock");
!!!!!!! $_sections_iblock_id = .укажи id инфоблока
$obCache = new CPHPCache;
if($obCache->InitCache(24*60, 'list_sections', '/cache_path/' ){
$vars = $obCache->GetVars();
$sections = $vars["sections"];
$sections_by_code = $vars["sections_by_code"];
} else if($obCache->StartDataCache()) {
@alexstep
alexstep / fopen-fputs.php
Created October 4, 2012 10:30
php wrtite file
// http://www.php.su/functions/?fopen
$filecontent = 'some content';
$file = fopen($_SERVER["DOCUMENT_ROOT"]."/path/name.txt","w+");
fputs($file, $filecontent);
fclose($file);
@alexstep
alexstep / bx_page_tpl.php
Created October 19, 2012 13:59
bitrix page template
<?php
/*
* Опиши тут, что это за файл!
*
*/
// define('SITE_TEMPLATE_ID','main');
require($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');
// CModule::IncludeModule("iblock");
// CModule::IncludeModule("forum");
@alexstep
alexstep / bx_inc_area
Created November 12, 2012 19:37
bitrix include area
<?$APPLICATION->IncludeFile(
$APPLICATION->GetTemplatePath("include_areas/filename.php"),
Array(),
Array(
"MODE"=>"text"
//"MODE"=>"html"
//"MODE"=>"php"
)
);?>
@alexstep
alexstep / bx_search.php
Created November 12, 2012 21:33
bitrix search page
<?$APPLICATION->IncludeComponent("bitrix:search.page", "", array(
"RESTART" => "N",
"NO_WORD_LOGIC" => "N",
"CHECK_DATES" => "N",
"USE_TITLE_RANK" => "N",
"DEFAULT_SORT" => "rank",
"FILTER_NAME" => "",
"arrFILTER" => array(
0 => "no",
),
@alexstep
alexstep / gist:5e3d4566c5b14b8e5352
Last active August 29, 2015 14:06
intall XBMC+addons p2pproxy vlc mono
#!/bin/bash
clear
echo ''
echo ''
echo ' !!! ВНИМАНИЕ !!! '
echo ' Ознакомьтесь с инструкцией http://habrahabr.ru/post/235523/'
echo ''
echo ' Всё что вы делаете вы делаете на свой страх и риск'
echo ''
echo 'Нажмити Enter для продолжения'
@alexstep
alexstep / pre-commit
Last active October 6, 2015 11:34
precommit validation js(jshint) php debug functions
#!/bin/sh
#
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@alexstep
alexstep / riot.tag
Last active April 17, 2017 08:44
riot.tag
<stat>
<script>
this.on('mount', ()=>{
})
</script>
<stat>
</stat>
0x0B5A5c67d302645A7781797faF1bc78361c9D4a8
// https://moment.github.io/luxon/docs/manual/math.html#time-math
const { DateTime } = require('luxon')
const myRoundDates = function (birthday_str){
const typesArr = {'years':'лет','months':'месяцев','weeks':'недель','days':'дней'}
const roundDates = {}
// Округление до ближайшего большего круглого значения
// в соответствии с разрядом числа