Skip to content

Instantly share code, notes, and snippets.

@ethanpil
ethanpil / gist:2c2820db71312a5004b1
Created May 23, 2014 21:02
Delete All Products From WooCommerce
#Delete all products from WooCommerce DB
#http://wordpress.org/support/topic/remove-all-woocommerce-products
DELETE relations.*, taxes.*, terms.*
FROM wp_term_relationships AS relations
INNER JOIN wp_term_taxonomy AS taxes
ON relations.term_taxonomy_id=taxes.term_taxonomy_id
INNER JOIN wp_terms AS terms
ON taxes.term_id=terms.term_id
WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product');
window.resolveLocalFileSystemURI(filePath, function(fileEntry) {
fileEntry.file(function(fileObj) {
console.log("Size = " + fileObj.size);
console.log("Size = " + fileObj.fullPath);
});
});
@ethanpil
ethanpil / gist:8675160
Created January 28, 2014 20:01
Insert A Random String from List in MySQL
UPDATE tablename
SET columnname = ELT(0.5 + RAND() * 6, 'value 1','value 2','value 3','value 4','value 5','value 6')
@ethanpil
ethanpil / gist:4074756
Created November 14, 2012 20:56
Simple Code Obfuscator for PHP
<?php
/* Simple Code Obfuscator for PHP
* See: http://stackoverflow.com/questions/232736/code-obfuscator-for-php/3781356#3781356
*/
$infile=$_SERVER['argv'][1];
$outfile=$_SERVER['argv'][2];
if (!$infile || !$outfile) {