Skip to content

Instantly share code, notes, and snippets.

@phillipwilhelm
phillipwilhelm / drivingDistanceAndTime.gs
Created December 10, 2020 05:12 — forked from lankanmon/drivingDistanceAndTime.gs
Find the distance (in KM or MI) and driving time between locations stored in Google Sheets. Distances and Time provided by Google Apps Script Maps Service.
/** drivingDistanceAndTime.gs **/
/** Find the distance (in KM or MI) and driving time between locations
stored in Google Sheets. Distances and Time provided by Google Apps Script Maps Service */
/** Note: This is built on top of Google App Scripts Code **/
/** Licensed under the Apache 2.0 License **/
/** By: Sandu Rajapakse - lankanmon **/
/** === USAGE INSTRUCTIONS ===
To use these functions in Google Sheets, place this code in a new script in the Script Editor.
@phillipwilhelm
phillipwilhelm / allow-wc-rest-api-queries-with-ip-check.php
Created November 22, 2020 05:09 — forked from damiencarbery/allow-wc-rest-api-queries-with-ip-check.php
Disable WooCommerce REST API authentication: Override WooCommerce capability check so that all REST API queries are allowed. https://www.damiencarbery.com/2019/07/disable-woocommerce-rest-api-authentication/
<?php
/*
Plugin Name: Disable WooCommerce REST API authentication
Plugin URI: https://www.damiencarbery.com/2019/07/disable-woocommerce-rest-api-authentication/
Description: Override WooCommerce capability check so that all REST API queries from specified IP are allowed
Author: Damien Carbery
Version: 0.1
*/
@phillipwilhelm
phillipwilhelm / order-details.txt
Created November 22, 2020 05:09 — forked from damiencarbery/order-details.txt
WooCommerce REST API authentication: Use Oauth 1 and the WooCommerce REST API to retrieve order details. https://www.damiencarbery.com/2019/06/woocommerce-rest-api-authentication/
{
"id": 7755,
"parent_id": 0,
"number": "7755",
"order_key": "wc_order_YjITxJBWgJIFu",
"created_via": "programatically",
"version": "3.6.4",
"status": "completed",
"currency": "EUR",
"date_created": "2019-06-11T08:58:35",
<?php
/*
// Restrict who can access this script.
$permitted_ips = array('12.34.56.78', '87.65.43.21');
if (in_array($_SERVER['REMOTE_ADDR'], $permitted_ips) == false) {
header('HTTP/1.0 403 Forbidden');
die();
}
*/
add_filter( 'gform_form_post_get_meta_7', 'add_form_fields' );
function add_form_fields( $form ) {
// Don't make the parent form messy
if ( ! GFCommon::is_form_editor() ) {
// form we are adding fields to
$parent_id = $form['id'];
// template form ID
$childId = 5;
@phillipwilhelm
phillipwilhelm / gf-map-class-to-post-meta.php
Created September 21, 2020 21:14 — forked from uamv/gf-map-class-to-post-meta.php
Save Gravity Form field data to post meta by adding a class to the field.
<?php
/**
* Save Gravity Form field data to post meta by adding a class to any field.
* Meta is mapped so that it is readable by Advanced Custom Fields
* Format class as…
* post_meta-{meta_key} -- for simple fields & writing lists as array to single meta record
* post_meta-{meta_key}-.3 -- for multi-input fields
* post_meta-{repeater_key}-1.{meta_key} -- for list fields mapped to meta readable by ACF
*/
// Run this function after the Gravity Form has created a post
@phillipwilhelm
phillipwilhelm / batch-download-images.sh
Created September 7, 2020 08:04 — forked from solepixel/batch-download-images.sh
Use wget to batch download a list of image URLs
wget -i image-list.txt --force-directories
@phillipwilhelm
phillipwilhelm / Booting-LiveUSB-Virtualbox.md
Created July 20, 2020 04:43 — forked from matthewjberger/Booting-LiveUSB-Virtualbox.md
Booting a Linux Live USB using Virtualbox

Check the drive number for your usb on windows using:

diskmgmt.msc

and looking for your USB drive.

Then, in a powershell admin terminal:

.\ps2exe.ps1 ..\form.ps1 -outputFile output.exe -requireAdmin -noConfigFile -noConsole -noError -nooutput -x64 -runtime40
from
https://gallery.technet.microsoft.com/scriptcenter/PS2EXE-GUI-Convert-e7cb69d5
@phillipwilhelm
phillipwilhelm / class-aggregator.php
Created July 2, 2020 04:37 — forked from gabrielcatellier/class-aggregator.php
Wordpress endpoint aggregator with Cache
<?php
/**
* Requires PHP 5.6+ due to the use of the splat operator and the [] "array declaration".
*/
class Rest_Aggregator {
/**
* Page number to fetch.