Skip to content

Instantly share code, notes, and snippets.

View Deifinger's full-sized avatar

Ruslan Kostikov Deifinger

View GitHub Profile
@Deifinger
Deifinger / scripts.json
Last active September 3, 2019 20:43
Bash script is used for running nested named scripts from "scripts.json"
{
"scripts": {
"dc": "ls @l",
"l": "-l",
"pwd": "pwd",
"echo": "echo Monkey",
"another": "sudo @dc",
"docker": "docker ps"
}
}
@Deifinger
Deifinger / composer
Last active August 6, 2019 11:55
PHP Optimization Advices
autoloader: https://symfony.com/doc/current/performance.html#performance-install-apcu-polyfill
@Deifinger
Deifinger / Container.php
Created July 25, 2019 10:27 — forked from MustafaMagdi/Container.php
PHP Dependency Injection Container
<?php
/**
* Class Container
*/
class Container
{
/**
* @var array
*/
@Deifinger
Deifinger / index.php
Last active March 11, 2019 20:43
Дана строка 1 и символы A-Z и AA-ZZ, нам известно что A = 1, Z = 26, AA=27, ZZ =702 и т.д А вторая строка такая же но начинается с A=703. НУжно при вводе цифры вывести строку и символы для данной циры..
<?php
//Задача:
//- Дана строка 1 и символы A-Z и AA-ZZ, нам известно что A = 1, Z = 26, AA=27, ZZ =702 и т.д
//А вторая строка такая же но начинается с A=703. НУжно при вводе цифры вывести строку и символы для данной циры..
function generate_row($prev_c = '', $nested = 0, $iter_nest = 1, $deep = 2)
{
$str = '';
++$nested;
for ($c = 65; $c < 91; $c++) {
@Deifinger
Deifinger / manager.sh
Created January 7, 2019 20:25
Project shell helper
#!/usr/bin/env bash
# Written with best practices:
# - https://www.davidpashley.com/articles/writing-robust-shell-scripts/
# - https://github.com/progrium/bashstyle
[[ "$TRACE" ]] && set -o xtrace # For debugging. Print command traces before executing command.
set -o errexit # Tells bash that it should exit the script if any statement returns a non-true return value
set -o nounset # Exit script if you try to use an uninitialised variable
set -o pipefail # false | true will be considered to have fail
@Deifinger
Deifinger / index.js
Last active June 21, 2018 14:16
Dijkstra's algorithm on JavaScript (es6)
const start = 'ml'
const graph = {
ml: {
zp: 30,
dp: 120,
},
zp: {
kv: 300,
dp: 70,
@Deifinger
Deifinger / .bash_profile
Created May 15, 2018 20:52
n - node js version manager - modifications for getting installed node js versions globally
# Changed PATH order, with §HOME/bin at the beginning, ahead of /usr/local/bin/
PATH=$HOME/.local/bin:$HOME/bin:$PATH
export PATH
# Add n prefix
export N_PREFIX=$HOME
@Deifinger
Deifinger / composer.json
Last active May 30, 2017 23:49
First Telegram bot
{
"require": {
"telegram-bot/api": "^2.2"
}
}
# ######################################################################
# # MEDIA TYPES AND CHARACTER ENCODINGS #
# ######################################################################
# ----------------------------------------------------------------------
# | Media types |
# ----------------------------------------------------------------------
# Serve resources with the proper media types (f.k.a. MIME types).
#
@Deifinger
Deifinger / WordPress Development .gitignore
Last active April 24, 2017 21:13 — forked from ixrevo/WordPress Development .gitignore
.gitignore file for setting up the WordPress development environment.
########################
# Wordpress Core files #
########################
wp-admin/
wp-content/backups/
wp-content/blogs.dir/
wp-content/languages/
wp-content/index.php
wp-content/themes/index.php
wp-includes/