How To Fix Defer Parsing of Javascript in WordPress (5 Ways)

As somebody who is trying to understand how to defer parsing of Javascript, we believe you have a problem. You own or have visited a website of somebody you know (maybe a client?) and it takes forever to load. And when you ran it through website speed testing tools, you got a recommendation which you’re not sure how to implement.

In this article, we’re going to share several ways of how to fix this warning and ultimately, make the website load faster, without throwing this error!

If you’re short on time, here are some quick actions you can do:

Instructions for How To Defer Parsing of JavaScript

  1. Download the Async plugin here.
  2. Click on Plugins > Add New > Upload plugin and select the file you have just downloaded.
  3. Click on Activate of the installed plugin.
  4. Go to Plugins and click on Settings for the Async plugin you have just installed.
  5. Clicking on Enable Async Javascript, or Apply Async as two of the most common ways to apply the fix.
  6. Test your website, to see that everything is still working well.

 

More:

Getting Started with Sphinx (video)

Sphinx is a powerful documentation generator that has many great features for writing technical documentation including:

  • Generate web pages, printable PDFs, documents for e-readers (ePub), and more all from the same sources
  • You can use reStructuredText or Markdown to write documentation
  • An extensive system of cross-referencing code and documentation
  • Syntax highlighted code samples
  • A vibrant ecosystem of first and third-party extensions

Quick start video

This screencast will help you get started or you can read our guide below.

Flask: PyCharm Integration

Prior to PyCharm 2018.1, the Flask CLI features weren’t yet fully integrated into PyCharm. We have to do a few tweaks to get them working smoothly. These instructions should be similar for any other IDE you might want to use.

In PyCharm, with your project open, click on Run from the menu bar and go to Edit Configurations. You’ll be greeted by a screen similar to this:

Add Https using Let’s Encrypt to Nginx configured as a reverse proxy on Ubuntu

To enable HTTPS on your website, you need to get a certificate (a type of file) from a Certificate Authority (CA). Let’s Encrypt is a CA. In order to get a certificate for your website’s domain from Let’s Encrypt, you have to demonstrate control over the domain. With Let’s Encrypt, you do this using software that uses the ACME protocol, which typically runs on your web host.

Let’s Encrypt uses the ACME protocol to verify that you control a given domain name and to issue you a certificate. To get a Let’s Encrypt certificate, you’ll need to choose a piece of ACME client software to use.

We use Certbot as ACME client. It can simply get a cert for you or also help you install, depending on what you prefer. It’s easy to use, works on many operating systems and has great documentation.

The first thing to before adding SSL in your website using Let’s Encrypt make sure that you have an ubuntu server running and have ssh access to it. Also, make sure that you have a domain that’s pointed to the server.

Install Lets Encrypt

To install Let’s Encrypt on ubuntu first add the repository.

For Ubuntu 16.04

sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update

For Ubuntu 18.04

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update

Then install LetsEncrypt which contains that contains cerbot and other libraries needed.

sudo apt-get install letsencryp

Verify ACME challenge using Nginx

To verify that we have control over a domain first we need to pass the ACME challenge. For that, we will configure Nginx to catch all request to /\.well-known/acme-challenge/ and host it in /var/www/letsencrypt .

Change you’re vhost so it looks like this. You can use default one located in /etc/nginx/sites-available/default

server {
        listen 80 default_server;
        listen [::]:80 default_server;location ~ /\.well-known/acme-challenge/ {
                allow all;
                root /var/www/letsencrypt;
                try_files $uri =404;
                break;
        }

Let’s create folder /var/www/letsencrypt to host the challenge.

mkdir /var/www/letsencrypt

Let’s check out Nginx setting are valid by running

sudo nginx -t

If you get a message like this you’re ready to go.

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Now let’s reboot our Nginx server to apply the changes

sudo service nginx reload

Generating Let’s Encrypt SSL

After setting up Let’s Encrypt now we will generate the SSL certificates. I’ll use ssl.example.comas an example domain name, use your own domain.

Now use this command to generate the SSL replace the following fields with your own fields.

  • mail@example.com with your own email address
  • ssl.example.com with your own domain

sudo letsencrypt certonly -a webroot --webroot-path=/var/www/letsencrypt -m mail@example.com --agree-tos -d ssl.example.com

You should see the congratulations message after this step.

Adding SSL to Nginx

Now let’s configure our virtual host file with new SSL certificates. I’ll use default config at /etc/nginx/sites-available/default but you can use your own, just replace ssl.example.com with your own domain name.

server {
    server_name ssl.example.com;
    listen 443 ssl;
    ssl on;
    ssl_certificate     /etc/letsencrypt/live/ssl.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/ssl.example.com/privkey.pem;location ~ /.well-known {
            root /var/www/letsencrypt;
            allow all;
    }}

Reverse proxy on Nginx

If you’ve got your web server running on localhost on your server you can use Nginx to proxy all the request to the web server. For example, I have a node server running at localhost:8000 and you can use this config to pass all request to local web server. Just replace the port inside location /with your server’s port number.

server {
    server_name ssl.example.com;
    listen 443 ssl;
    ssl on;
    ssl_certificate     /etc/letsencrypt/live/ssl.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/ssl.example.com/privkey.pem;location ~ /.well-known {
            root /var/www/letsencrypt;
            allow all;
    }location / {
            proxy_pass ;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
    }

Force all requests to https

If you want all the HTTP request to be forced into https request you can add this block in your Nginx config file.

server {
  listen 80 default_server;
  listen [::]:80 default_server;
  server_name ssl.example.com;
  return 301 https://$host$request_uri;
}

Automate renewal of SSL certificates

The SSL certificates issued by Let’s encrypt is only for 90 days. You can use following commands to automate the renewal of the certificates.

Create a script to run every day that checks and renews the certificate if they expire.

sudo touch /etc/cron.daily/letsencrypt

And set its permission.

sudo chmod +x /etc/cron.daily/letsencrypt

Now add the following content to the /etc/cron.daily/letsencrypt file.

Ubuntu 16.04

#!/bin/bash
/usr/bin/letsencrypt renew && /etc/init.d/nginx reload

Ubuntu 18.04

#!/bin/bash
/usr/bin/letsencrypt renew --renew-hook "/etc/init.d/nginx reload"

Conclusion

Adding SSL certificates makes your website more secure and make the site look more secure to search engines and even the user. Let’s Encrypt enables us to freely do it. So I think to do it essential of any web applications or websites.

Originally published on https://dipeshwagle.com.np/posts/add-https-using-nginx/

jQuery Hotkeys

jquery.hotkeys plugin lets you easily add and remove handlers for keyboard events anywhere in your code supporting almost any key combination. It takes one line of code to bind/unbind a hot key combination http://code.google.com/p/js-hotkeys/

Git Hub: Akismet support for Python 2/3

Comment Check

akismet.check('192.168.1.3', 'Firefox / COMMENT USER AGENT', comment_author='King Arthur',
              comment_author_email='arthur@camelot.co.uk', comment_author_url='https://web.archive.org/web/20190910140301/http://www.camelot.co.uk:80/',
              comment_content='The Lady of the Lake, her arm clad in the purest shimmering samite, '
                               'held aloft Excalibur from the bosom of the water, signifying by divine'
                               ' providence that I, Arthur, was to carry Excalibur. That is why I '
                               'am your king.', referrer='http://camelot-search/?q=Peasant+Woman')

Submit Ham

akismet.submit_ham('192.168.1.12', 'FIREFOX / COMMENT USER AGENT', comment_author='Tim',
                   comment_author_email='tim@witch.co.uk',
                   comment_author_url='http://witch.co.uk',
                   comment_content="Look, that rabbit's got a vicious streak a mile wide!"
                                   "It's a killer!")

Submit Spam

akismet.submit_spam('192.168.1.4', 'FIREFOX / COMMENT USER AGENT', comment_author='Frenchman',
                    comment_author_email='frenchman@guy-de-lombard.fr',
                    comment_author_url='',
                    comment_content="You don't frighten us, English pig-dogs! Go and boil your "
                                    "bottoms, sons of a silly person! I blow my nose at you, "
                                    "so-called Ah-thoor Keeng, you and all your silly English "
                                    "K-n-n-n-n-n-n-n-niggits!")