Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Ilya Bogatov EvilWolf

🏠
Working from home
Block or report user

Report or block EvilWolf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@EvilWolf
EvilWolf / .gitlab-ci.yml
Created Jun 4, 2019
Grav cms - deploy by gitlab.ci
View .gitlab-ci.yml
stages:
- build
- deploy
variables:
RELEASE_ARCHIVE: "release_${CI_COMMIT_SHORT_SHA}.tar.gz"
make archive:
stage: build
image: alpine:latest
@EvilWolf
EvilWolf / backup_mysql_databases.yml
Created Feb 9, 2019
Ansible playbook to backup compresed databases to directory
View backup_mysql_databases.yml
- hosts: mysql
vars:
backup_to: /root/backups/databases/
backup_current_dir: "{{ backup_to }}{{ ansible_date_time.date }}"
backup_age: "7d"
tasks:
- name: Collect mysql databases
shell: 'mysql -u root -e "select schema_name from information_schema.schemata where schema_name not in (\"information_schema\", \"mysql\", \"performance_schema\");"'
register: dblist
become: yes
@EvilWolf
EvilWolf / rotateMatrix.php
Last active Jan 4, 2019
Функция поворота матрицы на 90 градусов
View rotateMatrix.php
<?php
/**
* Пример функции поворота массива
* php version 7.2
*
* @category Algoritms
* @package Array
* @author Evil_Wolf <wolfofdeath@yandex.ru>
* @license MIT https://opensource.org/licenses/MIT
* @link https://ibogatov.ru/
@EvilWolf
EvilWolf / genDirectoryRecursive.php
Created Jan 6, 2018
Get all files form directory recursive | php generator
View genDirectoryRecursive.php
<?php
/* Get all and recursive files list, generator */
function genDirectoryRecursive($path) {
$directoryIterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($path),
RecursiveIteratorIterator::CHILD_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD
);
@EvilWolf
EvilWolf / sublime config
Created Dec 19, 2017
My SublimeText config
View sublime config
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - Afterglow/Afterglow-monokai.tmTheme",
"dictionary": "Packages/User/russian_english.dic",
"draw_white_space": "all",
"fold_buttons": false,
"font_size": 13,
"ignored_packages":
[
@EvilWolf
EvilWolf / page_template.php
Last active Nov 25, 2017
Шаблон с визуальной сеткой в 1C-Битрикс
View page_template.php
<?php
class PortfolioPageTemplate {
/* Возвращает массив с описанием шаблона страницы. */
function GetDescription() {
return [
'name' => 'Активный шаблон',
'description' => 'Тестовый активный шаблон',
'modules' => [],
];
@EvilWolf
EvilWolf / register.js
Created Nov 9, 2017
Вариант реализации регистрации на AJAX
View register.js
$(function(){
var $registerForm = $('#applicationRegisterForm');
/* Если форм на странице нет, то скрипт тут завершит свою работу */
if ($registerForm.length === 0)
return;
/* Валидатор, наверно можно удалить. */
$registerForm.find('.form-control').on('change', function(){
var $this = $(this);
$this.removeClass('parsley-error');
@EvilWolf
EvilWolf / mmenu-template.php
Created Nov 1, 2017
Простой шаблон mmenu для компонента menu в Битрикс
View mmenu-template.php
<? if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die(); ?>
<? if (!empty($arResult)): ?>
<nav id="mm-menu">
<ul class="navlist">
<?php
$lastDepth = 1;
foreach($arResult as $arItem):
if ($arItem['DEPTH_LEVEL'] > $arParams['MAX_LEVEL']) {
@EvilWolf
EvilWolf / import_rasvero.php
Last active Oct 13, 2017
Скрипт импорта XLSX в инфоблок. (Есть ещё что дорабатывать, но есть ли в этом смысл?) Зависит от https://github.com/nuovo/spreadsheet-reader
View import_rasvero.php
<?php
// Libraries
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
require_once('xlsx_reader/SpreadsheetReader.php');
// Statistics
$startTime = microtime(true);
echo 'Start Memory usage ' . (memory_get_usage(true) / 1024) . ' K byte';
echo '<br>---------------------------------<br><br>';
@EvilWolf
EvilWolf / header.php
Last active Oct 11, 2017
Заголовок шаблона для Битрикс
View header.php
<?php
use Bitrix\Main\Page\Asset;
$AssetManager = Asset::getInstance();
//$AssetManager->addCss();
//$AssetManager->addJs();
//$AssetManager->addString();
?>
<!DOCTYPE html>
<html lang="ru">
<head>
You can’t perform that action at this time.