Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |
<?php | |
// See https://lazycat.org/php-curl.html for license & known issues | |
// P.S. You'd better have a very good reason for using this instead of http://guzzlephp.org/ | |
function httpGet($url, $ttl = 86400) | |
{ | |
/* Change this or make it an option as appropriate. If you're | |
* getting urls that shouldn't be visible to the public, put the | |
* cache folder somewhere it can't be accessed from the web | |
*/ |
<?php | |
add_action("gform_field_input", "ih_gform_field_input", 10, 5); | |
function ih_gform_field_input($input, $field, $value, $lead_id, $form_id){ | |
//wp_debug($field); | |
if($field["type"] == "vehicleyear"){ | |
//wp_debug($field['choices']); | |
//$input = 'Aha!'; | |
} | |
return $input; | |
} |
<?php | |
// source: http://www.paulferrett.com/2009/php-camel-case-functions/ | |
/** | |
* Translates a camel case string into a string with underscores (e.g. firstName -> first_name) | |
* @param string $str String in camel case format | |
* @return string $str Translated into underscore format | |
*/ | |
function from_camel_case($str) { | |
$str[0] = strtolower($str[0]); |
add_action( 'woocommerce_thankyou', 'my_custom_tracking' ); | |
function my_custom_tracking( $order_id ) { | |
// Lets grab the order | |
$order = wc_get_order( $order_id ); | |
/** | |
* Put your tracking code here | |
* You can get the order total etc e.g. $order->get_total(); |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
/** | |
* Code goes in functions.php or a custom plugin. | |
*/ | |
add_action( 'woocommerce_email', 'unhook_those_pesky_emails' ); | |
function unhook_those_pesky_emails( $email_class ) { | |
/** | |
* Hooks for sending emails during store events | |
**/ |
No matter what, you're going to have to learn most everything on your own anyway. Self-learning is hard. Regardless of where, when or how you learn - being a good self-learner will maximize your potential.
In this post, Hamilton Ulmer (an almost-done Stanford stats masters student) and I, will explore seven ways to become a great self-learner.
<?php | |
/** | |
* Standard Tab Code from woocommerce-hooks.php | |
*/ | |
/* Product page tabs */ | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 ); | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 ); | |
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 ); | |
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 ); |
#!/bin/bash | |
## uploading to google | |
## rev: 22 Aug 2012 16:07 | |
det=`date +%F` | |
browser="Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0.1" | |
username="[email protected]" | |
password="password" | |
accountype="HOSTED" #gooApps = HOSTED , gmail=GOOGLE |