Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Ken Prince kjprince

🏠
Working from home
Block or report user

Report or block kjprince

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

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 Jul 13, 2017 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
View delete-all-woocommerce-products.php
<?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 Jul 13, 2017 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
View delete-all-woocommerce-products.php
<?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 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.
View Google Analytics Content Experiments code for Google Tag Manager
<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 Jun 19, 2015
3 Column Bootstrap Layout WP Posts
View wp-bootstrap-grid
<div class="container my-container">
<?php
$args=array(
'post_type' => 'reviews',
'post_status' => 'publish',
'posts_per_page' => 18
);
$my_query = null;
View gist:bad14742fd6fa0f82eec
Verifying that +kjprince is my openname (Bitcoin username). https://onename.com/kjprince
View gist:44ba9fc36de13560454f
<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 Feb 17, 2015
Server Cron Job and Backup
View backup-cron
# ------------------------------------------------------------------------------
# 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]
View test.md

Header 1

Overview {#overview}

Philosophy {#philosophy}

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

@kjprince
kjprince / NGINX Virtual Host
Created Mar 15, 2014
/etc/nginx/sites-available/mysite.com
View NGINX Virtual Host
# Virtual Host File
# Common wordpress configurations included in /etc/nginx/wordpress.conf
# All virtual hosts including this one are symlinked to /etc/nginx/sites-enabled
# Make sure you replace "mysite" with your domain name
server {
listen 80 default_server;
listen 443 ssl;
server_name mysite.com www.mysite.com *.mysite.com;
You can’t perform that action at this time.