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
class IceCreamMachine: | |
def __init__(self, ingredients, toppings): | |
self.ingredients = ingredients | |
self.toppings = toppings | |
def scoops(self): | |
final_scoops = [] | |
for ingredient in self.ingredients: | |
for topping in self.toppings: |
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
from collections import defaultdict | |
def group_by_owners(files): | |
# Grouping dictionary keys by value | |
res = defaultdict(list) | |
for key, val in files.items(): | |
res[val].append(key) | |
return res | |
if __name__ == "__main__": |
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
<p><?php | |
$vendor_id = 0; | |
foreach ( $order->get_items() as $item_id => $item ) { | |
$meta_data = $item->get_formatted_meta_data(); | |
// Get the meta data value of vendor id from one of the order item | |
$vendor_id = $item->get_meta("_vendor_id"); | |
break; | |
} | |
//get vendor data |
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
//Create folder for the child theme | |
mkdir -p /var/www/<your-website-directoy>/wp-content/themes/child-storefront/woocommerce/emails | |
//Add the customer-on-hold-order.php to the child theme emails template directory | |
cp /var/www/<your-website-directoy>/wp-content/plugins/woocommerce/templates/emails/customer-on-hold-order.php /var/www/<your-website-directoy>/wp-content/themes/child-storefront/woocommerce/emails | |
//Dont forget to grant permission to the folder :D | |
chown -R www-data:www-data /var/www/<your-website-directoy>/wp-content/themes/child-storefront/woocommerce/emails |
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
Parameters #Parameters | |
$handle | |
(string) (Required) Name of the script. Should be unique. | |
$src | |
(string) (Optional) Full URL of the script, or path of the script relative to the WordPress root directory. | |
Default value: '' |
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
function wp_add_javascripts() { | |
wp_enqueue_script('utils-js', | |
get_stylesheet_directory().'/assets/js/utils.js', array('jquery'),'1.1', true); | |
} | |
function wp_add_styles() { | |
wp_enqueue_style('utils-css', | |
get_stylesheet_directory().'/assets/css/utils.css'); | |
} |
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
//create the directories first in our child theme | |
mkdir -p /var/www/our-wordpress-site/wp-content/themes/child-storefront/assets/js | |
mkdir -p /var/www/our-wordpress-site/wp-content/themes/child-storefront/assets/css | |
//copy files from our machine to the server site. | |
scp utils.js alia@xxx:/var/www/our-wordpress-site/wp-content/themes/child-storefront/assets/js/ | |
scp utils.css alia@xxx:/var/www/our-wordpress-site/wp-content/themes/child-storefront/assets/css/ |
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
//javascript | |
var developers = <?php echo $parsed_array_to_json; ?>; | |
//access the value. | |
developers.forEach(logData); | |
function logData(value, index, array) { | |
console.log(value.name, value.age, value.job); | |
} |
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
$parsed_array_to_json = json_decode($developers); |
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
$developers = array( | |
array("name"=>"alia", "job"=>"freelancer", "age"=>"30"), | |
array("name"=>"naruto", "job"=>"freelancer hokage", "age"=>"30"), | |
array("name"=>"sasuke", "job"=>"freelancer spy", "age"=>"30") | |
); |