jquery form validation checkbox error placement — August 9, 2018

jquery form validation checkbox error placement

By default library adds error after checkbox and it looks weird. solution is errorPlacement for checkbox

errorPlacement: function (error, element) {
   if (element.attr("type") == "checkbox") {

for better explanation read this article.

PHP treats zero (0) as empty . How we can differentiate between zero and empty variable ? — August 8, 2018

PHP treats zero (0) as empty . How we can differentiate between zero and empty variable ?

Yep I was caught in this situation too.But solution is simple.
We cant use empty() to differentiate between 0 and empty variable. empty() returns true for both.
Easy solution is function


This will only return true is the variable is Numeric. Check this link for better explanation.

ES6 promise chaining example — July 15, 2018

ES6 promise chaining example

var asyncAdd = (a, b) => {
    return new Promise((resolve, reject) => {
	   if( typeof a === 'number' && typeof b === 'number' ) {
           } else {
		reject('Arguments must be numbers only');

var result = asyncAdd(5,7);

        //this is how we can chain promise. return a new promise again in result.
	return asyncAdd(result, 33);
	console.log(`Success Chained:-${result}`);
    console.log(`Error :-${errorMessage}`);
CSS indent text — July 13, 2018
Ubuntu Nginx enable ssl — June 12, 2018

Ubuntu Nginx enable ssl

There are so many blogs and videos about this topic but this video worked for me. It has all the information about ssl from start. So the steps in installing ssl involve

1.Create a Certificate Signing Request( CSR )
2.Submit the CSR to your service provider
3.Retrieve your new cert
4.Upload your new cert and private key to your server
5.Configure Nginx
chrome redirecting localhost Or vhost domains to https — June 1, 2018
Javascript createElement and add new attribute to it — May 31, 2018