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
SELECT meta_value | |
FROM wp_postmeta | |
WHERE meta_key = '_sku' | |
AND meta_value != '' | |
GROUP BY meta_value HAVING COUNT(meta_value) > 1 |
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
1 Intro to Fundamentals of Testing in JavaScript | |
2 Throw an Error with a Simple Test in JavaScript | |
3 Abstract Test Assertions into a JavaScript Assertion Library | |
4 Encapsulate and Isolate Tests by building a JavaScript Testing Framework | |
5 Support Async Tests with JavaScripts Promises through async await | |
6 Provide Testing Helper Functions as Globals in JavaScript | |
7 Verify Custom JavaScript Tests with Jest | |
8 Intro to Static Analysis Testing JavaScript Applications | |
9 Lint JavaScript by Configuring and Running ESLint | |
10 Use the ESLint Extension for VSCode |
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
// 1) Get the customer... required the get the payment method token | |
await braintreeGateway.customer.find( | |
billing_customer_id, | |
async (err, customer) => { | |
await braintreeGateway.subscription.find( | |
subscriptionId, | |
async (err, subscription) => { | |
if (err) { | |
res.status(400).json({ | |
error_message: err && err.code |
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
<?php | |
preg_match("/\d+(\.\d+)?x\d+(\.\d+)?/", $q, $new); | |
if ($new && $new[0]) { | |
$q = str_replace("x", " x ", $new[0]); | |
} | |
$args = array( | |
'posts_per_page' => 24, | |
'limit' => -1, |
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
/** | |
* Creates index keys. Groups an array of objects by the specified key group. | |
* Note: if there are multiple objects with the same key and the type arg is set to `object`, only the frst match will be included in the result | |
* @exmaple: | |
* const users = [{name:"jill", favColor:"teal"}, {name:"kim", favColor:"blue"},{name:"rachel", favColor:"teal"}] | |
* groupArrayItemsByKey(users, 'favColor') | |
* output: | |
* { | |
* teal":[ | |
* {"name":"jill","favColor":"teal"}, |
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
/* | |
Javascript Shallow Clone & Deep Clone Notes | |
-------------------------------------------- | |
"Variables that are assigned a non-primitive value are given a reference to that value. | |
That reference points to the object’s location in memory. | |
The variables don’t actually contain the value." | |
*/ | |
/*===================================================================================================*/ | |
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
import React from 'react' | |
import FormExample from '_helpers/FormExample' | |
/* | |
Add the form to your application. `initialValues` are handled through props as well as form submissions `onSubmit()` | |
*/ | |
<FormExample onSubmit={(values) => {window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`)}} initialValues={{date:null, textbox:'This was generated via `initialValues` prop on the Form!', switchExample:true, poops: true, ethnicity: 'asian' }} /> |
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
# DELETE all posts with category ID of "2906" | |
delete a,b,c,d | |
FROM wp_posts a | |
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id ) | |
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id ) | |
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id ) | |
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id ) | |
WHERE e.term_id = 2906 | |
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
// FREE: no request linit for ipify.org | |
var request = new XMLHttpRequest() | |
var ipAddress = '' | |
request.open('GET', "https://api.ipify.org?format=jsonp=", true) | |
var ipAddress = request.onload = function() { | |
if (request.status >= 200 && request.status < 400) { | |
// Success! | |
return ipAddress = request.responseText | |
} else { | |
// We reached our target server, but it returned an error |
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
# removes "wholesale-" prefix from all files. | |
for filename in wholesale-*; do | |
[ -f "$filename" ] || continue | |
mv "$filename" "${filename//wholesale-/}" | |
done |