Skip to content

Instantly share code, notes, and snippets.

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

Artem flayder

🏠
Working from home
View GitHub Profile
if(strpos($_SERVER['HTTP_USER_AGENT'],'Chrome-Lighthouse') !== false)
%product_cat%
function wpd_product_category_base_same_shop_base( $flash = false ){
$terms = get_terms(array(
'taxonomy' => 'product_cat',
'post_type' => 'product',
'hide_empty' => false,
));
if ($terms && !is_wp_error($terms)) {
$siteurl = esc_url(home_url('/'));
function func_gen_uuid() {
return sprintf( "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
mt_rand( 0, 0xffff ),
mt_rand( 0, 0x0fff ) | 0x4000,
mt_rand( 0, 0x3fff ) | 0x8000,
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
);
}
function func_send_data_to_ga($params) {
#nginx
location /websocket {
# switch off logging
#access_log off;
# redirect all HTTP traffic to localhost
proxy_pass http://127.0.0.1:8087;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
curl -L -w '\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n' -o /dev/null -s http://nikastal.ru
REWRITECOND %{HTTP_HOST} ^site.com [NC]
REDIRECTMATCH 301 (.*)\.html$ http://site.com$1
# Enable PageSpeed
pagespeed on;
#######################################################
# File cache settings
######################################
# needs to exist and be writable by nginx
pagespeed FileCacheSizeKb 102400;
pagespeed FileCacheCleanIntervalMs 3600000;
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
user apache;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
user apache;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;