This file contains hidden or 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
| To check a javascript object is empty, then you can use below code. | |
| In Newer browser empty checking: | |
| ================================ | |
| const empty = {}; | |
| Object.keys(empty).length === 0 && empty.constructor === Object; | |
| First method: | |
| function badEmptyCheck(value) { | |
| return Object.keys(value).length === 0; |
This file contains hidden or 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
| for node module install. | |
| npm install | |
| package.json: | |
| { | |
| "name": "test-plugin", | |
| "description": "TODO", | |
| "version": "2.2.0", | |
| "main": "Gruntfile.js", |
This file contains hidden or 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
| To enqueue admin scripts. | |
| $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles_and_scripts' ); | |
| To add admin menu | |
| $this->loader->add_action( 'admin_menu', $plugin_admin, 'admin_menu' ); | |
| public function admin_menu() { | |
| $capability = 'manage_options'; |
This file contains hidden or 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
| Node.js is javacsript based environment, whcih can use to create webserver and networked applivcation. | |
| You can also use it to perform helpful tasks on your computer such as concatenating and minifying JavaScript files and | |
| compiling Sass files into CSS. | |
| NPM is a “package manager” that makes installing Node “packages” fast and easy. A package, also called a module, is just a code library that extends Node by adding useful features. For example, the “request” module simplifies the process of making HTTP requests so you can easily get web resources from other sites. | |
| NPM is installed when you install Node.js®. | |
| https://treehouse.github.io/installation-guides/mac/node-mac.html | |
| https://treehouse.github.io/installation-guides/mac/homebrew |
This file contains hidden or 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. Arrow Function | |
| =============== | |
| In arrow function we don't need to use the key word: function | |
| if the function contain only contain one single line, then there is no need for using the opening body bracket({}) and return key word. | |
| if the function has only one argument, there is no need of argument paranthesis. | |
| eg: | |
| const sum = (a, b)=> { | |
| return a+b; | |
| } |
This file contains hidden or 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
| SQL: | |
| ===== | |
| They are relational database managment systems. | |
| SQL data base uses structured query language for defining and managing data. | |
| These have fixed, static or predefined schema. | |
| Best suited for complex queries. | |
| Vertically scalable (You can increase the load on a server by increasing the RAM, CPU, SSD). | |
| Follow ACID property. | |
| SQL data bases are tabale structure |
This file contains hidden or 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%); | |
| } |
This file contains hidden or 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 hidden or 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 hidden or 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, |