This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ES6 Features: | |
Classes. | |
Arrow functions. | |
Variable (let, var, const) | |
Array methods like .map(). | |
Destructuring. | |
Modules. | |
Ternary Operator. | |
Spread Operator. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Temporal Dead Zone (TDZ) and Hoisting in JavaScript: | |
Temporal Dead Zone: | |
=================== | |
Area of a block where the javascript variable is inaccessible untill the moment the computer completely intialised. | |
Block is a pair of braces used to group multiple braces. | |
Initialisation means: assigning a value to a variable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WP-CLI | |
======= | |
WP-CLI is a command line interface for wordpress. You can install WP, update plugin, install plugin, configure multisite and Much more without using web browser. | |
Download the wp-cli.phar file using wget or curl. | |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
Then, check if it works: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When we need to transfer/import a repository into new repository without loosing the all the prior commits. | |
Then follow the below steps. | |
1) Create a new repo with no any previous/initial commits like gitignore files or readme files. | |
Because this will create conflict with existing repo file of old repository. | |
2) Then clone the remote repo into a desired folder on your local system. | |
3) Checkout all the required remote branches in to the local branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) is_admin() check and AJAX Call | |
================================= | |
// Is admin, but not doing ajaax | |
if( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { | |
require_once('admin/functions_admin.php'); | |
} | |
// Is doing AJAX | |
else if ( is_admin() && ( defined( 'DOING_AJAX' ) || DOING_AJAX ) ) { | |
require_once('functions_ajax.php'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$csv_data = generate_csv_file_data($from_date, $to_date); | |
header("Pragma: public"); | |
header("Expires: 0"); | |
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); | |
header("Cache-Control: private", false); | |
header("Content-Type: application/octet-stream"); | |
header("Content-Disposition: attachment; filename=\"report.csv\";" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regular expression are patterns/combination of charactor used to match character, group of character or any combinations in a string. | |
$regular_expression = ''; | |
Regular expression is pattern which is enclosed between slashes. | |
So our reqular expression become, | |
$regular_expression = '//'; | |
^ This will match the begining of a line. | |
$ will indicate the end of a line. | |
So $regular_expression become, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The eval is used to execute the a string value. If you want to execute a string value like | |
an arithmetic string eg: "4+3*6", then you can use the eval function to calculate the string. | |
In php and javascript you can use the eval() function. | |
Javascript: | |
=========== | |
The eval() function will leads to many syntax error whenever the statement inside the function is not executable. | |
So you can use the try{}catch{} method. | |
var statement = "4+3*6"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1)Get the last element of array: | |
=============================== | |
let numbersArr = [4, 8, 9, 34, 100]; | |
numbersArr[numbersArr.length - 1]; //return 100 | |
2)Get a random number in a specific range: | |
========================================= | |
// Random number between 0 and 4. | |
Math.floor(Math.random() * 5); | |
// Random number between 0 and 49. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1)Using transform styling: | |
===================== | |
.child { | |
position: relative; | |
top: 50%; | |
-webkit-transform: translateY(-50%); | |
-ms-transform: translateY(-50%); | |
transform: translateY(-50%); | |
} |
NewerOlder