Skip to content

Instantly share code, notes, and snippets.

View miklb's full-sized avatar
🎣
Gone Fishing

Michael Bishop miklb

🎣
Gone Fishing
View GitHub Profile
@mikaelz
mikaelz / delete-all-woocommerce-products.php
Last active November 22, 2024 14:08
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')");
@voxpelli
voxpelli / README.md
Last active July 19, 2016 18:36
How to get references to all PR:s on a "git fetch origin" – forgot where I found this, but rediscovered the setup in one of my local repos

In the .git/config file add the fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to the remote you want to fetch references to PR:s from.

@PurpleBooth
PurpleBooth / README-Template.md
Last active May 15, 2025 16:42
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@poritsky
poritsky / Delete Completed Reminders.applescript
Created April 27, 2015 18:47
Delete Completed Reminders in Reminders.app
tell application "Reminders"
delete (every reminder whose completed is true)
end tell
@zmwangx
zmwangx / mac-keys-unicode.md
Last active March 15, 2025 00:10
Unicode characters for special keys on the Mac keyboard (not necessarily Mac specific). #symbols

⌘ – &#x2318; – &#8984; – the Command Key symbol
βŒ₯ – &#x2325; – &#8997; – the Option Key symbol
⇧ – &#x21E7; – &#8679; – the Shift Key symbol
βŒƒ – &#x2303; – &#8963; – the Control Key symbol
βŽ‹ – &#x238B; – &#9099; – the ESC Key symbol
β‡ͺ – &#x21ea; – &#8682; – the Capslock symbol
⏎ – &#x23ce; – &#9166; – the Return symbol
⌫ – &#x232b; – &#9003; – the Delete / Backspace symbol
β‡₯ – &#x21E5; – &#8677; – the Tab Key symbol

@danielbachhuber
danielbachhuber / gist:9379135
Created March 5, 2014 23:43
Fix network admin URL to include the "/wp/" base
<?php
/**
* Fix network admin URL to include the "/wp/" base
*
* @see https://core.trac.wordpress.org/ticket/23221
*/
add_filter( 'network_site_url', function( $url, $path, $scheme ){
$urls_to_fix = array(
'/wp-admin/network/',
@danklammer
danklammer / Flat Pinboard v1
Created February 2, 2014 21:16
A simple userstyle for pinboard.in bookmarking site
/* Theme Name: Flat Pinboard */
/* Theme URL: http://tackk.com/flat-pinboard */
/* Version: v1.0 */
/* Created by: Dan Klammer */
/* Broswer: Chrome + Stylish Extension */
html {
-webkit-font-smoothing:antialiased;
height:100%;
}
@hiilppp
hiilppp / insert_location.py
Created January 5, 2014 14:27
Python script to append the current location (either as address or Google Maps link) to the provided text (which may be "") in Pythonista and send the result (back) to Drafts.
# -*- coding: utf-8 -*-
# To call script from Drafts, use the follwing URLs as URL Actions:
# - <pythonista://insert_location.py?action=run&argv=[[draft]]&argv=address>
# (Will insert the address of your current location.)
# - <pythonista://insert_location.py?action=run&argv=[[draft]]&argv=link>
# (Will insert a Google Maps link to your current location.)
import location
import re
@hiilppp
hiilppp / calculate.py
Created December 6, 2013 11:42
Python script to calculate arithmetic expressions in Pythonista and send them, along with their results, (back) to Drafts.
# To call script from Drafts, use the follwing URL as URL Action:
# <pythonista://calculate.py?action=run&argv=[[draft]]>
# Except for the last ten lines, this script was written by Erez Shinan, see <http://erezsh.wordpress.com/2013/02/24/how-to-write-a-calculator-in-70-python-lines-by-writing-a-recursive-descent-parser/>.
'''A Calculator Implemented With A Top-Down, Recursive-Descent Parser'''
# Author: Erez Shinan, Dec 2012
import re, collections, sys
from operator import add,sub,mul,div
@seanbehan
seanbehan / wpdb_json_export.rb
Last active May 28, 2018 03:09
Export your wordpress db (post comments, tags and categories) as JSON
require 'active_record'
require 'wpdb'
require 'json'
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'localhost',
:port => 3306,
:username => 'root',
:password => '',