-
Laravel Deploy on nGinx LEMP
This tutorial explains how to publish a laravel project website on LEMP server (running nginx & mysql) on ubuntu. However, it should work the same on any other linux distribution based vps. Will PHP artisan serve work? php artisan serve command is not supposed to be used in production environment. The production environment doesn’t need […]
-
Load google fonts using javascript
We can load google fonts using javascript, resulting in better google pagespeed score. Google webfonts loader also allows us to set a timeout before loading the google fonts. The code would look like this: For more info: https://github.com/typekit/webfontloader Note: we can also load custom font files using webfontloader. More details on their github page.
-
Discord.js Bot Starter Template
This code will run a basic discord bot that you can split into commands and then keep everything organized in modules. Files: package.json index.js .env src/commands/index.js src/commands/ping.js (a sample command) You can add new commands in src/commands/ folder by copying the sample.js file and modifying it to suit your module. Then you have to edit […]
-
WordPress CheatSheet
Force add SSL / HTTPS without plugin First make sure that your wordpress site has WordPress Address (URL) and Site Address (URL) set to a https:// version in Settings > General. Fix redirect loop on WordPress https version Then if you go into a redirect loop while trying to reach https version, add this code […]
-
Run Ubuntu Virtual Machine on Macbook pro m1 (arm)
Basic steps and key points as of today are: UTM, virtualbox, vmware fusion will not help you run ubuntu virtual machine on your arm based macbook pro m1 (running apple silicon) You need to have parallels for it to work Install the latest beta version of 22.04 for arm processor. What did not work I […]
-
Redirect CheatSheet
This page lists methods to redirect a webpage using various technologies. How to redirect webpage using PHP How to redirect webpage using JavaScript How to redirect using on webpage using html meta http-equiv
-
PHP CheatSheet
Enable Error Display in PHP PDO CheatSheet This section includes cheatsheet of PDO. PHP PDO execute() returning duplicate results This can be solved by using FETCH_ASSOC with both fetch() or fetchAll() function. Note that you might need to use \PDO depending upon namespacing in your project, especially if it gives fatal error. PDO::FETCH_ASSOC not working […]
-
PHP OOP Concepts CheatSheet
What is a class property A class property is just like a variable, but declared inside a class (at base level, not inside a function / method). For example: What is a class method Method is simply a function inside a class. For example: PHP OOP Encapsulation Encapsulation simply means making the data private and […]
-
CSS CheatSheet
How to remove outline around focused input box or textarea CSS animation CSS animation fade in an element CSS animations don’t work on display property, so we can’t use keyframes to make an element display: none to display: block or anything else. Instead, we can use opacity. Example code would look like this: CSS transitions
-
JavaScript Cheatsheet
ForEach loop in javascript: Export & Import modules in JavaScript ES6 (node / react / nextjs) We can export multiple items from a single file in javascript ES6 module. Check following examples, all can happen in one file. Note that we also have one default export, also one “as” export (see below on how to […]