Skip to content

Instantly share code, notes, and snippets.

View wiesys's full-sized avatar

Viesturs Knopkens wiesys

View GitHub Profile
@wiesys
wiesys / most_bought.sql
Last active January 17, 2023 04:55
Pirktākās lietas
SELECT
order_item_name,
SUM(meta.meta_value) as total_quantity
FROM wp_woocommerce_order_items items
JOIN wp_woocommerce_order_itemmeta meta ON items.order_item_id = meta.order_item_id
WHERE
items.order_item_type = 'line_item'
AND meta.meta_key = '_qty'
AND items.order_id IN (
SELECT ID FROM wp_posts
@wiesys
wiesys / TreeTypings.ts
Last active October 23, 2021 10:05
Tree typings
type Warning = {
Id: string;
Type: string;
Content: string;
Active: boolean;
};
type Genus = {
Id: string;
Latin: string;
@wiesys
wiesys / swipe.js
Last active March 9, 2021 03:12 — forked from SleepWalker/swipe.js
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.changedTouches[0].pageX;
touchstartY = event.changedTouches[0].pageY;