Skip to content

Instantly share code, notes, and snippets.

View kjprince's full-sized avatar

Ken Prince kjprince

View GitHub Profile
/*
From the Magic List Youtube
https://gist.github.com/wirtzdan/cbaf758e707a9f5a498829c60519cd9b
*/
:root {
--font-size: 15.5px;
--font-color: hsl(205, 23%, 16%);

Keybase proof

I hereby claim:

  • I am kjprince on github.
  • I am kjprince (https://keybase.io/kjprince) on keybase.
  • I have a public key ASByjDRiL9ZAjpCrE-sddgUcvOeYwmA4d3rWrWpVj5N2eQo

To claim this, I am signing this object:

@kjprince
kjprince / delete-all-woocommerce-products.php
Created July 13, 2017 19:25 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
<?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')");
@kjprince
kjprince / delete-all-woocommerce-products.php
Created July 13, 2017 19:25 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
<?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')");
@kjprince
kjprince / Google Analytics Content Experiments code for Google Tag Manager
Created April 1, 2016 21:10
With this script you are good to go for client-site A/B/n testing with Content Experiments. Add ?var=1 to preview the variation of the A/B test.
<script src="//www.google-analytics.com/cx/api.js?experiment=YOUR_EXPERIMENT_ID"></script>
<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var varID = getParameterByName('var');
if(! varID){ var chosenVariation = cxApi.chooseVariation(); }
@kjprince
kjprince / wp-bootstrap-grid
Created June 19, 2015 19:18
3 Column Bootstrap Layout WP Posts
<div class="container my-container">
<?php
$args=array(
'post_type' => 'reviews',
'post_status' => 'publish',
'posts_per_page' => 18
);
$my_query = null;
Verifying that +kjprince is my openname (Bitcoin username). https://onename.com/kjprince
@kjprince
kjprince / gist:44ba9fc36de13560454f
Last active August 29, 2015 14:15
Hopewell Junction Insurance Agent http://princeagency.com
<p>This is a test to see if this strategy will work.</p>
<p>I'm going to see if I can add some inline links.</p>
<p><a href="http://princeagency.com" title="Hopewell Junction Insurance Agent" rel="follow">Hopewell Junction New York</a></p>
@kjprince
kjprince / backup-cron
Created February 17, 2015 18:13
Server Cron Job and Backup
# ------------------------------------------------------------------------------
# SETUP CRON JOBS 4 Backup + Server Love ---------------------------------------
# ------------------------------------------------------------------------------
# Start by opening the default logger
nano /etc/rsyslog.d/50-default.conf
# Start tracking cron jobs
Uncomment: cron.* [remove the "#" around line 10]
Uncomment: daemon.* [remove the "#" around line 11]

Header 1

Overview {#overview}

Philosophy {#philosophy}

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.