Skip to content

Instantly share code, notes, and snippets.

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

Alexandr aletoropov

🏠
Working from home
View GitHub Profile
@aletoropov
aletoropov / lemp-setup.sh
Last active May 20, 2021 10:18
Install LEMP
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
sudo apt-get install mysql-server mysql-client
sudo apt-get install php7.4 php7.4-fpm php7.4-mysql
@aletoropov
aletoropov / lamp-setup.sh
Last active May 20, 2021 14:13
Install LAMP
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
sudo apt-get install mysql-server mysql-client
@aletoropov
aletoropov / head.modx.html
Created July 9, 2023 09:03 — forked from eivko/head.modx.html
Заголовок в MODX (если не пустой, вставляется longtitle
<title>[[*longtitle:isnot=``:then=`[[*longtitle]]`:else=`[[*pagetitle]]`]]</title>
@aletoropov
aletoropov / adduser.php
Created July 9, 2023 09:04 — forked from eivko/adduser.php
Создание Super User-а для MODX
<?php
$username = 'vasya';
$password = 'qwerty';
$email = '[email protected]';
$sudo = true;
require 'config.core.php';
require MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
if ((!$modx) || (!$modx instanceof modX)) {
@aletoropov
aletoropov / functions.php
Last active January 5, 2024 15:56
Удаление inline стилей в WordPress
<?php
add_action( 'wp_print_styles', function()
{
wp_styles()->add_data( 'jet-smart-filters-inline-css', 'after', '' );
} );
add_action( 'init', 'remove_my_style_stylesheet', PHP_INT_MAX );
function remove_my_style_stylesheet() {
wp_deregister_style( 'jet-smart-filters-inline-css' );
}
add_action( 'wp_enqueue_scripts', function() {
@aletoropov
aletoropov / functions.php
Created January 5, 2024 15:56
отключить доставку и оплату в Woocommerce
<?php
//отключаем параметры доставки по стране
add_filter( 'woocommerce_cart_needs_shipping', 'woocommerce_disable_shipping' );
function woocommerce_disable_shipping() {
return false;
}
//отключаем параметры оплаты
add_filter( 'woocommerce_cart_needs_payment', 'woocommerce_disabled_payment' );
function woocommerce_disabled_payment() {
return false;
@aletoropov
aletoropov / scripts.js
Last active February 22, 2024 17:20
Слушатель события отправки формы
document.querySelector('form').addEventListener('submit', (e) => {
e.preventDefault()
const data = Object.fromEntries(new FormData(e.target).entries());
console.log(data)
});
@aletoropov
aletoropov / redirect.js
Created February 22, 2024 17:23
Редирект с помощью JavaScript
window.location.replace('https://aletoropov.ru');
@aletoropov
aletoropov / .htaccess
Created February 22, 2024 17:29
Редирект с HTTP на HTTPS
# Редирект с http на https
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# Конец редиректа
@aletoropov
aletoropov / update.sh
Created June 22, 2024 15:10
Обновление и очистка системы (Ubuntu, Linux Mint)
#!/bin/bash
echo "Update & clean system..."
sudo apt-get update
sudo apt-get upgrade
sudo apt autoclean
sudo apt clean
sudo apt autoremove
sudo snap set system refresh.retain=2
dpkg -l | awk '/^rc/ {print $2}' | xargs sudo dpkg --purge