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
add_filter( 'product_type_selector', 'remove_product_types' ); | |
function remove_product_types( $types ){ | |
unset( $types['grouped'] ); | |
unset( $types['external'] ); | |
unset( $types['variable'] ); | |
return $types; | |
} |
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
product_add_to_cart : function(){ | |
var ajx_data = {}; | |
var ajx_grab = {}; | |
$(document).on('change','.single-product .variations_form select',function(e){ | |
var $this = $(this); | |
var pro_id = $(".single-product .variations_form").attr('data-product_id'); | |
var attribute_name = $this.attr('data-attribute_name'); | |
var attribute_value = $this.val(); | |
var post_ajxurl = window.location+"?wc-ajax=get_variation"; |
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
function tv_find_matching_product_variation( $product, $attributes ) | |
{ | |
foreach( $attributes as $key => $value ) | |
{ | |
if( strpos( $key, 'attribute_' ) === 0 ) | |
{ | |
continue; | |
} | |
unset( $attributes[ $key ] ); |
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
// Complete the diagonalDifference function below. | |
function diagonalDifference($arr) { | |
$d_ar = []; | |
$main_len = count($arr); | |
foreach($arr as $key => $ar) { | |
$sub_len = count($ar); | |
if($main_len != $sub_len) { | |
throw new Exception('Array index count mismatched. Hence this is not square array.'); | |
} |
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
# Colors definition | |
BLUE='\e[94m' | |
L_BLUE='\e[96m' | |
YELLOW='\e[93m' | |
GREEN='\e[32m' | |
L_GREEN='\e[92m' | |
RED='\e[31m' | |
L_RED='\e[91m' | |
NC='\e[0m' |
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
SQL query for renaming the posts: | |
UPDATE `wp_posts` SET `post_type` = '<new post type name>' WHERE `post_type` = '<old post type name>'; | |
SQL query for renaming taxonomy: | |
UPDATE `wp_term_taxonomy` SET `taxonomy` = '<new taxonomy name>' WHERE `taxonomy` = '<old taxonomy name>'; | |
# That should take care of all of the database areas. Just remember to match the new names in the code where the post types or taxonomies are registered. As far as I know, this is not handled in any plugins yet. |
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
#!/bin/bash | |
#################################### | |
# | |
# Open all required porjects. | |
# | |
#################################### | |
gnome-terminal --tab --command="bash -c 'cd /path/to/your/project/angular-project-1; npm start; $SHELL'" \ | |
--tab --command="bash -c 'cd /path/to/your/project/angular-project-2; ng serve -p 4201; $SHELL'" \ | |
--tab --command="bash -c 'cd /path/to/your/project/angular-project-3; ng serve -p 4202; $SHELL'" |
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
class Solution: | |
def isValid(self, s: str) -> bool: | |
s = s.replace(' ','') | |
if len(s)%2 != 0: | |
return False | |
dict = {'(' : ')', '[' : ']', '{' : '}'} | |
ar = [] | |
for i in s: | |
if i in dict: | |
ar.append(i) |
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
class Solution: | |
def romanToInt(self, s: str) -> int: | |
roman_dict = { 'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000, 'IV':4, 'IX':9, 'XL':40, 'XC':90, 'CD':400, 'CM':900 } | |
i = 0 | |
sum = 0 | |
while i < len(s): | |
if s[i:i+2] in roman_dict and i+1<len(s): | |
sum+=roman_dict[s[i:i+2]] | |
i+=2 | |
else: |
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
class Solution: | |
def longestCommonPrefix(self, strs: List[str]) -> str: | |
if len(strs) == 0: | |
return "" | |
common_prefix = strs[0] | |
for i in range(1,len(strs)): | |
temp = "" | |
if len(common_prefix) == 0: | |
break | |
for j in range(len(strs[i])): |
NewerOlder