• Javascript inheritance implementation using prototypes
    This is a fully functional implementation with no weird back references or unwanted functionality. I’ve gone through many different implementations before settling on this. Keep in mind that I had some constraints you may not have and could not use the new ECMA 2015 syntax that introduced the “class” keyword among many other great enhancements. The Javascript world is full of surprises and tricks that could leave your head spinning for days especially if you are coming from a world of structure and order such as Java or C#. Object inheritance is complicated and messy, there are several ways of … Continue reading “Javascript inheritance implementation using prototypes”
  • Automating letsencrypt certificate renewal with cron
    Letsencrypt allows you to install free SSL certificates on your site. The certificates expire after 3 months and they need to be renewed to avoid certificate errors. Depending on how you install letsencrypt, and once you configure the certificates on the site, you will want to setup automatic renewal so you don’t have to manually check and renew. You can setup automated renewals using cron scheduling tool on linux and the following steps: 1. Sudo to root user:sudo su – 2. Edit crontab file:crontab -e 3. Add the following line:00 9 * * 6 /etc/letsencrypt/.certbot-auto renew –no-random-sleep-on-renew –renew-hook ‘/sbin/service httpd … Continue reading “Automating letsencrypt certificate renewal with cron”
  • How to display the git version on your site
    Here is a quick guide on how to automatically update the build version of your site directly from git. This approach leverages the “hook” functionality to get the build hash after a commit. Versioning files is a must for any developer and git version control system is one of the de facto choices for that job. It’s my personal favorite as well. You can learn more about git here. Go into your projects .git folder, then hooks. You should see a list of sample hooks already there. Create a new one called “post-commit” (note there is no file extension). Add … Continue reading “How to display the git version on your site”
  • WooCommerce default to free shipping or legacy free shipping
    Recent WooCommerce updates (starting with 2.6.0) introduced the concept of shipping zones.  You have the option to configure Shipping Zones, which will provide the standard selections like Flat Rate, Free Shipping and Local Pickup.   In the meantime however, the existing shipping methods will be renamed with a legacy “legacy_” prefix and that can cause some of the shipping customizations to no longer work. One of those is the snippet provided by WooCommerce used to hide all other shipping methods when free shipping is available. The code relies on the shipping method using method_id of free_shipping and no longer works since the … Continue reading “WooCommerce default to free shipping or legacy free shipping”
  • Secure EC2 Apache server with Let’s Encrypt
    Having an SSL secured website is no longer just a preference for sites handling sensitive data but is a necessity for all websites. There are many good reasons to secure your site even if only to improve the ranking in Google search. Let’s Encrypt is a Certificate Authority organization providing free SSL certificates. The project is supported by many large technology organizations with the goal of securing all websites on the web. The certificates are free and are valid for three months at a time. A few assumptions before proceeding: -You have installed the AMI Linux on the EC2 instance … Continue reading “Secure EC2 Apache server with Let’s Encrypt”