Skip to content

Instantly share code, notes, and snippets.

@junaidtk
junaidtk / CSS naming convention
Created August 12, 2020 07:49
CSS Naming Conventions
Below is the naming conventions for HTML structure.
=====================================================
Names are written in lowercase Latin letters.
Words are separated by a hyphen (-).
The block name defines the namespace for its elements and modifiers.
The element name is separated from the block name by a double underscore (__).
@junaidtk
junaidtk / Python Installation
Created August 8, 2020 11:22
Install Python and Create local environment
Install Python and Create local environment
===============================================
Some basic Commands to note i your memory
check selenium is installed or not.
===========================================
$ python3 -c "import selenium; print(selenium.__version__)"
@junaidtk
junaidtk / Selenium Automation
Created August 8, 2020 09:32
Web Automation Testing using Selenium and Python
Web Automation Testing using Selenium and Python
=================================================
First you need to check the python is already installed in the system.
In order to check this just type the below command
$ python or $ python3
It will result the as given below
@junaidtk
junaidtk / Basic command and description
Created August 6, 2020 07:36
Basic command line code used by developer.
grep
==============
Grep search a specific patten in each file
$ grep "some string" file
Search a string in a specific.
@junaidtk
junaidtk / Enable Xdebug in MAC
Created November 21, 2019 04:59
Formatting the var_dump in MAMP
This is used to formate the debuging mode of the MAMP.
Here we need to enable the xdebug module in mamp in php ini file.
There are two different php ini file in, The locations are following.
/Applications/MAMP/bin/php/php7.3.8/conf/php.ini ---- In bin folder
/Applications/MAMP/conf/php7.3.8/php.ini ---- In conf folder
In bin folder open php.ini file and uncomment the line
zend_extension="/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
WPML plugin is used for making the multi lingual website.
This will allow user to add transalted version of posts, category, page, product etc.
WPML use the parse_query hook to modify query. Using this filter WPML adds query modification.
The argument suppress_filters is used for removing the filter added in the query
like posts_search, posts_search_orderby, posts_where etc. All these type of queries will execute if the suppress_filters is false.
Default value of suppress filter is false in the WP_Query. So it will return only the posts in the current language.
But get_posts() return all the posts in the posts. because suppress_filters is true in this function by default.
Introduced in the PHP 5.
PHP will call this method, when ever we create a new object. So it is used for the any initialisation before object start.
Parent constructors are not called implicitly in the child class. In order to get the parent constructors in child class
we need to add the statement parent::__construct() within the child constructor.
If the child doesn't contain any __construct(), then the parent class __construct() method will be inherited.
<?php
class grandpa{
@junaidtk
junaidtk / jQuery submit()
Created October 11, 2019 03:55
jQuery submit() doesn't include its value.
If we are using the button in the form for submitting the data, then it will work if we click the button.
If we are using the jQuery.submit() function for submiting the form. Then the button value doesn't submit.
For working form with the button value without an issue you just need to configure the a hidden input
and add all the button property to the hidden field.
Below is the code for configuring the form.
$("input[type=submit], input[type=button], button").click(function(e) {
var self= $(this),
@junaidtk
junaidtk / Make outer 100% Height
Created September 30, 2019 10:43
Give parent div 100% height for floated inner elements
When we apply the float to inner elements and the outer div is not taking the height. Then you can use below snippets.
<div class="containing-div">
<div class="floating-div">
<ul>
<li>List Item One</li>
<li>List Item Two</li>
<li>List Item Three</li>
<li>List Item Four</li>
</ul>
@junaidtk
junaidtk / Dynamic Hook used in "woocommerce_product_get_price"
Last active August 22, 2019 10:12
Some of Dynamics hooks used in the woocommerce
In woo-commerce there are lot of filter they are dynamically generated for the multiple function use.
So these hooks are hard to find and can't be found while searching the woocommerce folder.
The below hook is the one of the dynamic hooks used in the woocommerce
1) get_property hooks for the woocommerce product class (woocommerce_product_get_price).
=========================================================
All the get_functions in the WooCommerce product class, like $product->get_price(),
use the get_prop() method under the dynamic filter hook
This is part of the WC_Data class that WC_Product extends.