Instantly share code, notes, and snippets.

View send-woocommerce-order-emails.php
<?php
/**
* Send WooCommerce order email(s)
*
* @param integer $order_id WooCommerce order id.
* @param string|array $email_id The id of the email or an array of the email ids that need to send.
* @return bool Type returned Will return true if the email id provided is sent successfully.
*/
function send_wc_order_email($order_id, $email_id) {
View US_States_and_Cities.json
{
"New York": [
"New York",
"Buffalo",
"Rochester",
"Yonkers",
"Syracuse",
"Albany",
"New Rochelle",
"Mount Vernon",
View gist:20e1a60add63bd7879de1da1f8c10c96
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==">
View print_are.php
<?php
/**
* A pretty version of "print_r" function
*
* @param Array|stdClass $obj
* @param string $title Optional.
* @param bool $collapse Optional.
* @return string Type returned.
*/
View gist:8a069045e0f487c2a0fe
$.ajax({
url: '/URL/',
type: 'POST', /* POST/GET */
dataType: 'json', /* xml/html/script/json/jsonp */
data: form_data,
crossDomain: true,
success: function(data, textStatus, xhr) {
/* success */
},
error: function(xhr, textStatus, errorThrown) {
View jQuery: preload an image
var src = "http://placekitten.com/500/500",
img = $("<img />");
img.hide().attr("src", src);
img.load(function() {
// Image is loaded
});
View gist:11183021
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
View jQuery: add ie version number to HTML class attribute
if(jQuery.browser.msie){
var version = jQuery.browser.version;
switch(version){
case "6.0":
jQuery("html").addClass("ie ie6 lte10 lte9 lte8 lte7");
break;
case "7.0":
jQuery("html").addClass("ie ie7 lte10 lte9 lte8 lte7");
break;
case "8.0":