Skip to content

Instantly share code, notes, and snippets.

View mborodov's full-sized avatar
🏠
Working from home

Maksim Borodov mborodov

🏠
Working from home
View GitHub Profile
@mborodov
mborodov / alpine-telnet-install.md
Last active March 14, 2023 09:23
How to install telnet into a alpine docker container
docker exec -it CONTAINERID sh
/app # telnet
sh: telnet: not found

/app # apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/aarch64/APKINDEX.tar.gz
v3.16.4-66-g2c3dfa6d54d [https://dl-cdn.alpinelinux.org/alpine/v3.16/main]
v3.16.4-66-g2c3dfa6d54d [https://dl-cdn.alpinelinux.org/alpine/v3.16/community]
@mborodov
mborodov / arraySortingByKeyValue.php
Last active August 2, 2022 06:53
Sort the elements in the array. The first elements will be those without a value in the key, then those with a value.
<?php
$flatList = [
[
'id' => '3',
'parentId' => '1',
'parentSku' => ''
],
[
'id' => '2',
<?php
/**
* Код для поиска шаблона Бп по некоторому PHP коду(активити).
* Выполнить код в Командной строке PHP Админки Битрикс24
*/
// Зададим строку для поиска
$findString = 'echo 1';
// Подключим модуь бизнесс процессов
@mborodov
mborodov / select-first-ption.js
Created January 14, 2019 06:13
Pre-select first option for Magento 2 options swatcher
if (this.options.jsonConfig.attributes.length > 0) {
var selectswatch = this.element.find('.' + this.options.classes.attributeClass + ' .' + this.options.classes.attributeOptionsWrapper);
$.each(selectswatch, function (index, item) {
var swatchOption = $(item).find('div.swatch-option').first();
if (swatchOption.length && !$(item).find('div.swatch-option').hasClass('selected')) {
swatchOption.trigger('click');
}
});
}
@mborodov
mborodov / docker-compose.mac.yml
Created December 24, 2018 20:00
Magento 2 docker sync yml config
version: '2'
services:
web:
image: s.kt-team.de/nike/magento:latest
volumes:
- m2-sync:/repo/magento #add 2
- ${PWD}/../../build/configs/nike.loc/20-xdebug.ini:/etc/php.d/15-xdebug.ini
- ${PWD}/../../build/configs/nike.loc/nginx:/etc/nginx
- ${PWD}/../../build/configs/nike.loc/ssmtp:/etc/ssmtp
- ${PWD}/../../build/configs/nike.loc/env.php:/repo/magento/app/etc/env.php
@mborodov
mborodov / wp-docker.sh
Last active October 5, 2018 12:46
Script for generate Router.php, Dockerfile and docker-compose.yml files for start WP container
#!/usr/bin/env bash
curl -O https://gist.githubusercontent.com/mborodov/fec94e11863b5f014a8e2a0ec48d28c9/raw/a36f7b9c0c5d6f506fd49e617549e727c21aa31b/router.php
cat > Dockerfile << EOF
FROM php:7.2
MAINTAINER Maksim Borodov
RUN docker-php-ext-install mbstring pdo pdo_mysql
EOF
@mborodov
mborodov / router.php
Created October 4, 2018 13:48 — forked from wnstn/router.php
Wordpress router.php, for using the built in PHP server with WP sites.
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
if(file_exists($root.$path))
{
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
{
header('location: '.rtrim($path,'/').'/');
@mborodov
mborodov / docker-compose.yml
Created October 1, 2018 11:58
PHP server on php image docker-compose
version: '3.5'
services:
server:
image: php:7.2
command: php -S 0.0.0.0:8000 /app/index.php
ports:
- "8000:8000"
volumes:
@mborodov
mborodov / docker-compose.yml
Created October 1, 2018 11:35
Nginx docker compose file
version: "3"
services:
web:
image: nginx:latest
container_name: nginx
volumes:
- ./web:/usr/share/nginx/html
ports:
- "80:80"
restart: always
@mborodov
mborodov / docker-compose.yml
Created October 1, 2018 11:34
Redis docker compose file
version: '3.5'
services:
redis:
image: redis:alpine
container_name: redis
volumes:
- './data:/data'
ports:
- '6379:6379'