View initGoProject.sh
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 | |
WORK_DIR=`dirname ${0}` | |
PROJECT_NAME=${1} | |
mkdir ${PROJECT_NAME} | |
cd "${WORK_DIR}/${PROJECT_NAME}" |
View computeIntervalIntersectionsProgressive.ts
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
/* | |
* Ну и скомбинировав два этих способа, я пришел к выводу, что можно все же вычислить индексы пересечений, и при этом оставить | |
* простой алгоритм, не зависящий от размера числа. | |
* Здесь создаем объект, в который поместим индексы которые пересеклись, и точки. Да точек тут будет меньше, только 2, | |
* чтобы показать в каких точках произошло пересечение, всю глубину, как в 1ом алгоритме мы не выявим. | |
* По сути поиск как во втором алгоритме, только мы клонировали массив, чтобы нам можно было искать индексы в изначальной структуре. | |
* Для этого мы заводим вот такую функцию findIndexByNumber, она то и будет по числу возвращать нам индекс. | |
* | |
* Есть и в этом алгоритме недостаток, если в передаваемых диапазонах, встретятся одинаковые числа, | |
* то индекс для обоих случаев проставится одинаковый |
View RabbitAdapter.php
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 | |
namespace Adapters; | |
use Vendor\PhpAmqpLib\Connection\AMQPStreamConnection; | |
use Vendor\PhpAmqpLib\Message\AMQPMessage; | |
class RabbitAdapter | |
{ |
View git hist
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
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(green)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short" |
View DiskSpace.php
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 | |
namespace backend\components; | |
/** | |
* Class FreeSpace for calculating free hard disk space | |
* only php 7.0 or later | |
* @package backend\components | |
*/ | |
class DiskSpace |
View DateEntity.php
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 | |
/* | |
* Методы класса | |
* __construct($date) - должен получить строку с датой, или пустой, просто | |
* DateToTimestamp() - переводит полученную в конструктор дату в timestamp unix | |
* dateToBlog() - возвращает строку типа Суббота, 18 Март 2017 | |
* RusDayofWeak() - возвращает русское название дня недели | |
* RusNameofMonth() - возвращает русское название месяца | |
*/ |
View MobilePhoneFormatExample.php
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 | |
function FormatMobilePhone($phone) { | |
return preg_replace('#(\d{1})(\d{3})(\d{3})(\d{2})(\d{2})#Us', '+$1 ($2) $3-$4-$5', $phone); | |
} | |
$phone = "79154401700"; |
View Logger.php
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 | |
namespace console\components; | |
/** | |
* Class Logger | |
* The component of logging the script execution. Good for console applications | |
* @package console\components | |
*/ | |
class Logger { |
View ValidatorFilesClass.php
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 | |
/* | |
* Класс ValidatorFiles предназначен для проверки файлов или папок на возможность создания, записи, удаления и возможности манипуляций с файлами | |
* Класс не поддерживает вызов статических методов, при вызове класса, необходимо передать переменные пути и флаг вывода массива | |
* | |
* |-----Свойства класса-------------------------------------------------| | |
* | protected $path - путь, над которым будет произведен анализ | | |
* | protected $showaccess - флаг вывода информации | | |
* |---------------------------------------------------------------------| | |
* |