This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'result is ' . $arResult['SOME_KEY']['key']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"net/url" | |
"strconv" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Интерфейс для посещаемого | |
* Посещаемые объекты должны реализовывать | |
* - метод accept - принятие посетителя | |
* - метод getTotalCount - получение общей суммы чего-либо | |
* | |
*/ | |
interface IDlvVisitee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('BOT_TOKEN', 'YOUR_BOT_TOKEN_HERE'); | |
$wh_url = 'YOUR_WEB_HOOK_URL'; // must support https! | |
$url = 'https://api.telegram.org/bot' . BOT_TOKEN . '/setWebhook?' . http_build_query(['url' => $wh_url]); | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$r = curl_exec($ch); | |
curl_close($ch); | |
var_dump($r); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Your project path | |
cd /path/to/project | |
# Base branch which will be rebased, suppose it's "master" | |
baseBranch="base_branch" | |
# Current branch | |
curBranch=`git status |head -n 1| grep "branch" | cut -d ' ' -f 4` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Checking statuses of local and remote versions of current branch | |
# | |
# If commits from these branches differ, then someone forgot to run `git pull` | |
echo "Checking for changes before commit:" | |
echo "Fetching new info..." | |
git fetch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Some queries to bitrix tables | |
-- `b_option` stores your options | |
select count(*) from b_option; | |
-- select options for a certain module | |
select * from b_option where MODULE_ID = 'module.name'; | |
-- select option for a certain module with a certain name | |
select * from b_option where MODULE_ID = 'module.name' and NAME ='NAME_GOES_HERE' | |
-- delete all options for a certain module | |
delete from b_option where MODULE_ID = 'module.name'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$year = 2016; | |
foreach (range(1,12) as $month) { | |
var_dump(getDaysCount($month, $year)); | |
} | |
function getDaysCount($month, $year) | |
{ | |
return date('t', strtotime('01.' . $month . '.' . $year)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Linked posts | |
// https://math.stackexchange.com/questions/176363/keep-getting-generating-function-wrong-making-change-for-a-dollar/176397#176397 | |
// https://math.stackexchange.com/questions/15521/making-change-for-a-dollar-and-other-number-partitioning-problems | |
// Simple solution: | |
// Sum you need to count | |
$money = 4; | |
// Coin variants, no matter what order | |
$coins = [1,2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Source example comes from https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&LESSON_ID=2978 | |
$cacheTime = 10; | |
$cacheId = 'cache_id_comes_here'; | |
$cacheDir = '/some_tag_cache/subsubdir'; | |
/* D7 version */ | |
$cache = Bitrix\Main\Data\Cache::createInstance(); | |
if ($cache->initCache($cacheTime, $cacheId, $cacheDir)) |
OlderNewer