Skip to content

Instantly share code, notes, and snippets.

simongcc / delete-all-woocommerce-products.php
Last active Sep 7, 2020 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
View delete-all-woocommerce-products.php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
View YouTube API — getting video thumbnail
Each YouTube video has 4 generated images. They are predictably formatted as follows:<insert-youtube-video-id-here>/0.jpg<insert-youtube-video-id-here>/1.jpg<insert-youtube-video-id-here>/2.jpg<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:<insert-youtube-video-id-here>/default.jpg
simongcc / custom-search-acf-wordpress.php
Created Mar 2, 2020 — forked from charleslouis/custom-search-acf-wordpress.php
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
View custom-search-acf-wordpress.php
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
simongcc / horizontal-infinite-carousel.html
Created Oct 30, 2019 — forked from dongyuwei/horizontal-infinite-carousel.html
infinite loop carousel(vertical or horizontal)
View horizontal-infinite-carousel.html
View dabblet.css
/* CSS States */
body {
background: url(;
background-color: #F5F2F0;
font-family: Georgia, serif;
font-size: 18px;
line-height: 1.6em;
text-shadow: 0 2px 0 white;
color: #222;
simongcc / threejsBoilerplate.html
Created Apr 2, 2019 — forked from HalfdanJ/threejsBoilerplate.html
THREE.JS Boilerplate with controls
View threejsBoilerplate.html
<!doctype html>
<title>Three.js Boilerplate</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src=""></script>
<script src=""></script>
simongcc /
Created Mar 15, 2019 — forked from rob-smallshire/
Notes on getting macOS Sierra running in Virtualbox on a Windows 10 host

On Mac

Download, but don't run, the Sierra installer from the Mac App Store. This places the installer at /Applications/Install\ macOS\

Now run the following commands to build a suitable VM image from the installer:

git clone
cd osx-vm-templates/packer
sudo ../prepare_iso/ -D DISABLE_REMOTE_MANAGEMENT -o macOS_10.12.vdi /Applications/Install\ macOS\ .
simongcc / index.php
Created Jan 3, 2019 — forked from johndyer/index.php
Gutenberg Shortcode Block with Live Preview
View index.php
* Plugin Name: JD Gutenberg Shortcode Preview
* Description: Live shortcode previews in Gutenberg
* Author: johndyer
* Version: 1.0.0
// Exit if accessed directly.
simongcc / repeat.js
Created Jan 7, 2018 — forked from nathansmith/repeat.js
Handlebars.js helper to generate dummy UI.
View repeat.js
Handlebars helper to generate dummy UI.
For instance, a 10x10 table with 100 cells:
{{#repeat 10}}
{{#repeat 10}}
simongcc /
Created Oct 3, 2017 — forked from rxin/
ramdisk create/delete on Mac OS X.
# From
if [ $# -ne $ARGS ] # correct number of arguments to the script;