One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
const useFetch = (url) => { | |
const cache = useRef({}); | |
const [status, setStatus] = useState('idle'); | |
const [data, setData] = useState([]); | |
useEffect(() => { | |
let cancelRequest = false; | |
if (!url) return; | |
const fetchData = async () => { |
def get_file_list(path, extensions=['jpg', 'jpeg', 'png']): | |
'''returns a (flat) list of paths of all files of (certain types) recursively under a path''' | |
paths = [os.path.join(root, name) | |
for root, dirs, files in os.walk(path) | |
for name in files | |
if name.lower().endswith(tuple(extensions))] | |
return paths |
const fs = require('fs') | |
function dirExistSync(dirPath) { | |
try { | |
return fs.statSync(dirPath).isDirectory() | |
} catch (e) { | |
if (e.code === 'ENOENT') { | |
return false | |
} else { | |
throw e |
function debug_to_console( $data ) { | |
if ( is_array( $data ) ) | |
$output = "<script>console.log( 'Debug Objects: " . implode( ',', $data) . "' );</script>"; | |
else | |
$output = "<script>console.log( 'Debug Objects: " . $data . "' );</script>"; | |
echo $output; | |
} |
/** | |
* Update the order meta with field value | |
*/ | |
add_action( 'woocommerce_checkout_update_order_meta', 'k2r_custom_checkout_field_update_order_meta' ); | |
function k2r_custom_checkout_field_update_order_meta( $order_id ) { | |
if ( ! empty( $_POST['shipping_phone'] ) ) { | |
update_post_meta( $order_id, 'Shipping Phone', sanitize_text_field( $_POST['shipping_phone'] ) ); | |
} | |
} |
jQuery.fn.brightness = function() { | |
var bg_color, rgba, y; | |
bg_color = this.css('background-color'); | |
if ((bg_color != null) && bg_color.length) { | |
rgba = bg_color.match(/^rgb(?:a)?\(([0-9]{1,3}),\s([0-9]{1,3}),\s([0-9]{1,3})(?:,\s)?([0-9]{1,3})?\)$/); | |
if (rgba != null) { | |
if (rgba[4] === '0') { | |
if (this.parent().length) return this.parent().brightness(); | |
} else { | |
y = 2.99 * rgba[1] + 5.87 * rgba[2] + 1.14 * rgba[3]; |
Created by Christopher Manning
[
](http://bl.ocks.org/d/1703449/#/[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169]43/0/1)
[
](http://bl.ocks.
Created by Christopher Manning
[
](http://bl.ocks.org/d/1703449/#/[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169]43/0/1)
[
](http://bl.ocks.
the_excerpt_max_charlength(140); | |
function the_excerpt_max_charlength($charlength) { | |
$excerpt = get_the_excerpt(); | |
$charlength++; | |
if ( mb_strlen( $excerpt ) > $charlength ) { | |
$subex = mb_substr( $excerpt, 0, $charlength - 5 ); | |
$exwords = explode( ' ', $subex ); |