This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMPORARY TABLE ALL_ORDERS_IN_GIVEN_TIMEFRAME ( | |
SELECT ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN.order_item_id, ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN.product_name, ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN.post_date, meta_value AS email FROM (SELECT ITEMS.order_item_id, ITEMS.order_item_name AS product_name, ITEMS.order_id, MAIN_POSTS.post_date FROM wp_mokkamerch_posts AS MAIN_POSTS | |
JOIN wp_PREFIX_woocommerce_order_items AS ITEMS ON MAIN_POSTS.ID = ITEMS.order_id | |
WHERE DATE(MAIN_POSTS.post_date) BETWEEN "2016-12-01" AND "2017-01-01" AND (MAIN_POSTS.post_status = "wc-completed" OR MAIN_POSTS.post_status = "wc-production") AND ITEMS.order_item_type = "line_item") AS ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN | |
JOIN wp_PREFIX_postmeta AS MAIN_POSTMETA ON ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN.order_id = MAIN_POSTMETA.post_id AND MAIN_POSTMETA.meta_key = "_billing_email" AND MAIN_POSTMETA.meta_value <> '[email protected]' | |
); | |
CREATE TEMPORARY TABLE ITEMMETA_SUMMARY ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- variables: PREFIX; URL; HTDOCS_DIR | |
-- TODO/TRY UPDATE PREFIXposts SET guid = replace(guid, 'URL', 'http://localhost:8888/HTDOCS_DIR'); | |
UPDATE PREFIXoptions SET option_value = replace(option_value, 'URL', 'http://localhost:8888/HTDOCS_DIR') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE PREFIXposts SET post_content = replace(post_content, 'URL', 'http://localhost:8888/HTDOCS_DIR'); | |
UPDATE PREFIXpostmeta SET meta_value = replace(meta_value, 'URL','http://localhost:8888/HTDOCS_DIR'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $ALL_ORDERS_IN_GIVEN_TIMEFRAME = $wpdb->query('CREATE TEMPORARY TABLE ALL_ORDERS_IN_GIVEN_TIMEFRAME (SELECT ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN.order_item_id, ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN.product_name, ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN.post_date, meta_value AS email FROM (SELECT ITEMS.order_item_id, ITEMS.order_item_name AS product_name, ITEMS.order_id, MAIN_POSTS.post_date FROM wp_PREFIX_posts AS MAIN_POSTS JOIN wp_PREFIX_woocommerce_order_items AS ITEMS ON MAIN_POSTS.ID = ITEMS.order_id WHERE DATE(MAIN_POSTS.post_date) BETWEEN "2016-12-01" AND "2017-01-01" AND (MAIN_POSTS.post_status = "wc-completed" OR MAIN_POSTS.post_status = "wc-production") AND ITEMS.order_item_type = "line_item") AS ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN JOIN wp_PREFIX_postmeta AS MAIN_POSTMETA ON ALL_ORDERS_IN_GIVEN_TIMEFRAME_PLAIN.order_id = MAIN_POSTMETA.post_id AND MAIN_POSTMETA.meta_key = "_billing_email" AND MAIN_POSTMETA.meta_value <> "[email protected]");'); | |
$ITEMMETA_SUMMARY = $wpdb->query('CREATE TE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock | |
/Applications/MAMP/Library/bin/mysql | |
/usr/local/mysql/bin/mysql -u {username} -p {databasename} < file_name.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rm -r --cached . | |
git add . | |
git commit -m ".gitignore is now working" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function waitForElementToAppear(selector, time) { | |
if(document.querySelector(selector)!=null) { | |
alert("The element is displayed, you can put your code instead of this alert."); | |
return; | |
} | |
else { | |
setTimeout(function() { | |
waitForElementToAppear(selector, time); | |
}, time); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo nano /etc/nginx/sites-enabled/default | |
# HTTP — redirect all traffic to HTTPS | |
server { | |
listen 80; | |
listen [::]:80 default_server ipv6only=on; | |
return 301 https://$host$request_uri; | |
} | |
# HTTPS — proxy all requests to the Node app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.createUser( | |
{ | |
user: "XXX", | |
pwd: "XXX", | |
roles: [ { role: "root", db: "admin" } ] | |
} | |
) | |
mongoimport -u 'ACTUALUSERNAME' -p 'PASSWORD' --authenticationDatabase admin -d DATABASE -c COLLECTION --type csv --file FILEPATH.csv --headerline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pm2 start ecosystem.config.js --env production_mongodb | |
scp /path/to/file username@a:/path/to/destination | |
tar -czvf foo-bar.tar.gz `find foo-bar*` | |
find ./order-export-* -maxdepth 0 -type f -delete |
OlderNewer