Skip to content

Instantly share code, notes, and snippets.

View ilyautkin's full-sized avatar

Ilya Utkin ilyautkin

View GitHub Profile
<?php
$url = 'https://fonts.googleapis.com/css2?family=Lato:wght@100;300;400;700&display=swap';
$opts = [
'http' => [
'method' => 'GET',
'header' => 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36'
]
];
@ilyautkin
ilyautkin / .gitignore
Created October 8, 2021 12:01
Стандартный gitignore
# Logs and databases #
######################
*.log
*.logs
*.sql
*.sqlite
server-logs
# OS generated files #
######################
@ilyautkin
ilyautkin / vhost.conf
Created October 8, 2021 11:28
Конфиг сервера NGinx
server {
listen 80;
server_name localhost;
root /var/doodle/www;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
index index.php index.html index.htm;
@ilyautkin
ilyautkin / Dockerfile
Created October 8, 2021 11:25
Стандартный Dockerfile
FROM php:7.4-fpm
RUN apt-get update -y
RUN apt-get install -y \
libbz2-dev \
libxml2-dev \
git \
libzip-dev \
libc-client-dev \
libkrb5-dev \
#!/bin/bash
echo "Select theme version:";
echo "1. Basic";
echo "2. Advanced";
echo "3. Webshop";
while [ "$version" = "" ]
do
read -p "Enter selected number: " version;
@ilyautkin
ilyautkin / create-tables-from-model.php
Created April 28, 2021 12:27
MODX создать таблицы MIGXdb из модели
<?php
$modx->addPackage('site', MODX_CORE_PATH . 'components/site/model/');
$manager = $modx->getManager();
$objects = [];
$schemaFile = MODX_CORE_PATH . 'components/site/model/schema/site.mysql.schema.xml';
if (is_file($schemaFile)) {
$schema = new SimpleXMLElement($schemaFile, 0, true);
if (isset($schema->object)) {
foreach ($schema->object as $obj) {
<!doctype html>
<html {if $_config.manager_direction EQ 'rtl'}dir="rtl"{/if} lang="{$_config.cultureKey}" xml:lang="{$_config.cultureKey}">
<head>
<meta charset="{$_config.modx_charset}">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>{$_lang.login_title} | {$_config.site_name|strip_tags|escape}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="noindex, nofollow">
{if $_config.manager_favicon_url}
<?php
class SixtyCoder {
public $table = '0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ';
public function to60($number = 0) {
$number = (int) $number;
$output = '';
return $this->divide($number);
}
@ilyautkin
ilyautkin / postcalc_light_lib.php
Created November 27, 2020 09:59
Changed libs for msRussianPost with key
<?php
require_once 'postcalc_light_config.php';
global $modx;
function postcalc_request($From, $To, $Weight, $Valuation = 0, $Country = 'RU')
{
$key = ''; //Ваш ключ
<?php
if ($modx->event->name != "OnHandleRequest" || $modx->context->key == 'mgr') {
return;
}
$tmp = explode('?', $_SERVER['REQUEST_URI']);
$link = trim($tmp[0], '/');
if (isset($tmp[1]) && $tmp[1]) {
$params = '?' . $tmp[1];
} else {
$params = '';