Skip to content

Instantly share code, notes, and snippets.

View ilyahoilik's full-sized avatar

Ilya Hoilik ilyahoilik

View GitHub Profile
@ilyahoilik
ilyahoilik / list_files.php
Created December 5, 2021 14:22
This is how to list all files inside a directory and all subdirectories. Works well in browser and command line.
<?php
$is_cli = php_sapi_name() == 'cli';
/**
* List all files inside a directory and all subdirectories.
*
* @param mixed $directory
* @param bool $is_cli
* @return void
# This robots.txt file is created by Ilya Hoilik.
# You can contribute by visiting the link bellow.
# https://gist.github.com/ilyahoilik/c6d70d828f42aae429e3e84283fb85f7
User-agent: *
# Folders and files
Disallow: /admin
Disallow: /api
Disallow: /applications
@ilyahoilik
ilyahoilik / add_departure_on_enter.js
Created December 4, 2019 18:52
Добавляет новый интервал и рейс при нажатии Enter на Народной Яндекс.Карте
;(function (undefined) {
"use strict";
let CreateNewDepatureOnEnter = {
initialize: function () {
document.addEventListener('keypress', this.onKeyPress.bind(this));
},
onKeyPress: function (e) {
<?php
function get_word_form( $count, $word_forms = [ 'предмет', 'предмета', 'предметов' ] ) {
$count = preg_replace( '/[^\d]/', '', $count );
$n100 = $count % 100;
$n10 = $count % 10;
if ( ( $n100 > 10 ) && ( $n100 < 20 ) ) {
return $word_forms[2];
} elseif ( $n10 == 1 ) {