Skip to content

Instantly share code, notes, and snippets.

@junaidtk
junaidtk / SQL vs NoSQL
Created June 3, 2021 05:51
Database Systems
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
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;
}
@junaidtk
junaidtk / Grunt and npm
Created February 19, 2021 12:15
Grunt install and npm
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
@junaidtk
junaidtk / Admin Minimum hooks
Created February 13, 2021 04:16
Plugin Development
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';
for node module install.
npm install
package.json:
{
"name": "test-plugin",
"description": "TODO",
"version": "2.2.0",
"main": "Gruntfile.js",
@junaidtk
junaidtk / To check a javascript object is empty or not
Created December 8, 2020 04:42
Empty Javascript Object check
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;
@junaidtk
junaidtk / javascript variable types : var, let, const
Last active March 2, 2021 10:28
Javascript variable and its declaration
These are three type of javascript variabe declaration.
var
====
Function scoped or globally Scoped.
Reassignable and Redeclarable
Not subject to temporal dead zone.
var language = "JavaScript";
function foo() {
var language = "Python";
@junaidtk
junaidtk / Name space
Last active May 11, 2022 12:43
PHP Namespace Concepts
While creating large applications, then there may be chances of collision between class names, function names.
So to avoid these problems PHP "Namespaces" provide a way in which to group related classes, interfaces, functions and constants.
In the PHP world, namespaces are intended to take care of two issues
that creators of libraries and applications experience when making re-usable code components, Those are:
1.Name impact between code you create, and internal PHP classes/functions/constants or third-party classes/functions/constants.
2.Ability to abbreviate Extra_Long_Names for improving the readability of source code.
@junaidtk
junaidtk / WP-Cron Jobs
Created August 14, 2020 05:22
How to create a basic Cron job scheduling in WP
WP-Cron Jobs
=============
Wp-Cron handles scheduling time-based tasks in WordPress. Several WordPress core features, such as checking for updates and publishing scheduled post, utilize WP-Cron.
WP-Cron works by checking, on every page load, a list of scheduled tasks to see what needs to be run. Any tasks due to run will be called during that page load.
Scheduling errors could occur if you schedule a task for 2:00PM and no page loads occur until 5:00PM.
With WP-Cron, all scheduled tasks are put into a queue and will run at the next opportunity (meaning the next page load). So while you can’t be 100% sure when your task will run, you can be 100% sure that it will run eventually.
@junaidtk
junaidtk / Development Tools in chrome
Created August 14, 2020 05:02
Chrome Advanced Development tools
Chrome Advanced Development tools
==================================
Chrome Command Menu
-------------------
The command menu in chrome help many powerfull feature in the chrome page.
Command + shift + P provide the command menu. where we can use many command operations.
1) Powerfull screenshots
Screenshot Capture full size screenshot : Full size screenshot of the complete page
Screenshot Capture node screenshot : Current node screenshot. You can select the node from the Elements tab