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
/** | |
* Run this in your browser console and it will delete all of your facebook photos | |
* one after another. | |
* | |
* You will most likely need to fiddle with the css selectors but its basically: | |
* 1. Click edit of first photo | |
* 2. Click delete in dropdown menu | |
* 3. Click confirm in dialog | |
*/ | |
setInterval(() => { |
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
const EARTH_RADIUS = 6371000; | |
/** | |
* Calculates the great-circle distance between two points, with | |
* the Haversine formula. | |
* | |
* @param float $latitudeFrom Latitude of start point in [deg decimal] | |
* @param float $longitudeFrom Longitude of start point in [deg decimal] | |
* @param float $latitudeTo Latitude of target point in [deg decimal] |
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 | |
if (!wp_next_scheduled('set_last_month_product_sales_hook')) { | |
wp_schedule_event(time(), 'daily', 'set_last_month_product_sales_hook'); | |
} | |
add_action('set_last_month_product_sales_hook', 'cc_set_last_month_sales'); | |
function cc_set_last_month_sales() | |
{ |
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
/* | |
Uploading images is a two step process (from https://github.com/WP-API/WP-API/issues/1768#issuecomment-160540932): | |
POST the data to /wp/v2/media - this can either be as the request body, or in multipart format. This will upload the file, and give you a 201 Created response with a Location header. This header points to the post object for the attachment that has just been created. | |
PUT the post data to the endpoint returned in the Location header (which will look something like /wp/v2/media/{id}). | |
I do step 2 (PUT), if POST is a success, in myDropzone.on("success", function(file, response){} | |
*/ | |
// dropzoneWordpressRestApiForm is the configuration for the element that has an id attribute |