Categories
blog Storefront WooCommerce wordpress

wordpress Good Good Optimize Stuff




/// Good Good Optimize Stuff ...



// block WP enum scans 
if (!is_admin()) {
    // default URL format
    if (preg_match('/author=([0-9]*)/i', $_SERVER['QUERY_STRING'])) die();
    add_filter('redirect_canonical', 'shapeSpace_check_enum', 10, 2);
}
function shapeSpace_check_enum($redirect, $request) {
    // permalink URL format
    if (preg_match('/\?author=([0-9]*)(\/*)/i', $request)) die();
    else return $redirect;
}

 
add_action( 'wp_default_scripts', function( $scripts ) {
    if ( ! empty( $scripts->registered['jquery'] ) ) {
        $jquery_dependencies = $scripts->registered['jquery']->deps;
        $scripts->registered['jquery']->deps = array_diff( $jquery_dependencies, array( 'jquery-migrate' ) );
    }
} );
/**
 * Optimize WooCommerce Scripts
 * Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
 */
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );

 

function cc_mime_types($mimes) {
    $mimes['svg'] = 'image/svg+xml';
    return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
  
function woo_registration_redirect() {
    return home_url( '' );
}
 
add_filter( 'registration_redirect', 'woo_registration_redirect' );

remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // start link
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Display relational links for the posts adjacent to the current post.
remove_action( 'wp_head', 'wp_generator' ); // Display the XHTML generator that is generated on the wp_head hook, WP version
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );

function optimize_jquery() {
    if (!is_admin()) {
        //wp_deregister_script('jquery');
        wp_deregister_script('jquery-migrate.min');
        wp_deregister_script('comment-reply.min');
        $protocol='http:';
        if($_SERVER['HTTPS']=='on') {
            $protocol='https:';
        }
    }
}
add_action('template_redirect', 'optimize_jquery');

// Defer Javascripts
// Defer jQuery Parsing using the HTML5 defer property
if (!(is_admin() )) {
    function defer_parsing_of_js ( $url ) {
        if ( FALSE === strpos( $url, '.js' ) ) return $url;
        if ( strpos( $url, 'jquery.js' ) ) return $url;
        // return "$url' defer ";
        return "$url' defer onload='";
    }
    add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
}


// Disable Heartbeat
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}

 

// Remove WP Version From Styles    
add_filter( 'style_loader_src', 'sdt_remove_ver_css_js', 9999 );
// Remove WP Version From Scripts
add_filter( 'script_loader_src', 'sdt_remove_ver_css_js', 9999 );

// Function to remove version numbers
function sdt_remove_ver_css_js( $src ) {
    if ( strpos( $src, 'ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}

Categories
blog conf Meteor Nginx

nginx conf meteor

# this section is needed to proxy web-socket connections
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# HTTP
server {
listen 80;
server_name classified.sumnima.me;

location = /favicon.ico {

access_log off;
}

# pass requests to Meteor
location / {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; #for websockets
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}

Categories
blog haiku poem

macbook overheating – winter

Blowing hot memories –
Macbooks,
Freezing finger.

#haiku #nahaiwrimo #macbook #overheating #winter #memories

Categories
blog haiku poem

Death haiku

Death –
Final Truth
Stop blaming other.

2016 – 2018 A D

#haiku #mouse #macOS #Logitech

Categories
blog js

add body class based on the url using RegEx

/* add body class */
var loc = window.location.pathname.match(/^\/?(\w+)\b/);
if(loc) $(document.body).addClass(loc[1].toLowerCase());

 

https://gist.github.com/mware/4118884

Categories
blog shopify

shopify supply scss media

#bookmark #shopify #scss #supply
desktop only – @include at-query ($min, $medium)
tablet and mobile – @include at-query ($max, $medium)
mobile only – @include at-query($max, $small)

Categories
bigcommerce blog

node.js, npm, bigcommerce, Stencil CLI, cornerstone… bla bla bla !!!

 

pain free NODE.js https://gist.github.com/isaacs/579814

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl -O -L https://npmjs.org/install.sh

 

Installing the Command-Line Interface

The first step toward developing on Stencil is to install the Stencil CLI (command-line interface). You can do this via the following command:

npm install -g @bigcommerce/stencil-cli

Adding a Base Theme

git clone https://github.com/bigcommerce/cornerstone.git

after download complete cd cornerstone then run

npm install
stencil init

at the top level of your Stencil Theme. It will ask you a few questions to get your started.

stencil start

to run a local server so you can start developing your theme.

stencil bundle

to validate your code and create a zip bundle file that can be uploaded to BigCommerce.

 

 

https://github.com/bigcommerce/stencil-cli/issues/311

upgrade you cli

npm i -g @bigcommerce/stencil-cli

 

Categories
blog ecommerce magento magento 2

Moving Product Tabs – Magento 2

app/design/frontend/Vendor/theme_name/Magento_Catalog/page_layout/catalog_product_view.xml

<move element="product.info.details" destination="product.info.main" after="product_options_wrapper_bottom"/>
Categories
blog magento magento 2 SSH

php -f bin/magento setup:upgrade

php -f bin/magento setup:upgrade
Categories
blog Linux Nginx SSH ubuntu

nginx shutdown terminal ssh

sudo shutdown -h now