Skip to content

Instantly share code, notes, and snippets.


Trajche TJ Kralev trajche

  • Helsinki, Finland
View GitHub Profile
trajche /
Last active Oct 5, 2021
Download and install a WP instance (Mac, Valet, MySQL)
mysql -u root -e "create database wp_sitename";
wp core download
wp config create --dbname=wp_sitename --dbuser=root --dbpass=
wp core install --url=https://woocommerce.test --title=WooCommerce --admin_user=admin --admin_password=admin
wp plugin uninstall akismet
wp plugin uninstall hello
wp plugin install woocommerce
trajche / mac
Last active Jun 20, 2022
new mac set-up
View mac
sh -c "$(curl -fsSL"
sh -c "$(curl -fsSL"
brew install --cask google-chrome
brew install --cask tunnelblick
#Communication Tools
brew install --cask slack
trajche / WonderCMSValetDriver.php
Created Jan 17, 2021
Valet Driver for WonderCMS
View WonderCMSValetDriver.php
class WonderCMSValetDriver extends ValetDriver
* Determine if the driver serves the request.
* @param string $sitePath
* @param string $siteName
* @param string $uri
trajche /
Created Oct 27, 2020 — forked from nileshtrivedi/
Home Server setup: Raspberry PI on Internet via reverse SSH tunnel

Raspberry Pi on Internet via reverse SSH tunnel

HackerNews discussed this with many alternative solutions:

I already have my own domain name: I wanted to be able to run some webapps on my Raspberry Pi 4B running perpetually at home in headless mode (just needs 5W power and wireless internet). I wanted to be able to access these apps from public Internet. Dynamic DNS wasn't an option because my ISP blocks all incoming traffic. ngrok would work but the free plan is too restrictive.

I bought a cheap 2GB RAM, 20GB disk VM + a 25GB volume on Hetzner for about 4 EUR/month. Hetzner gave me a static IP for it. I haven't purchased a floating IP yet.

View test.skema
trajche / allow-admin-coupons-fix.patch
Created Apr 22, 2020
Patch for allowing admins to create Dokan coupons.
View allow-admin-coupons-fix.patch
From 962ea6ad8940dc9339423e1fbc7e01a40db75c99 Mon Sep 17 00:00:00 2001
From: TJ <>
Date: Thu, 23 Apr 2020 02:52:55 +0300
Subject: [PATCH] applying fix from
includes/Admin/Settings.php | 11 ++
includes/Commission.php | 6 +-
includes/Order/Hooks.php | 86 +++++++++++++-
trajche / wp-one-liner
Created Dec 11, 2019
One liner for WordPress download and unpacking in the current directory.
View wp-one-liner
curl -O && unzip && rm && mv wordpress/* ./ && rm -r wordpress/
trajche / headerparser.php
Last active Nov 5, 2019
link rel parser for headers in shopify / github
View headerparser.php
function returnHeaderArray($linkHeader) {
$cleanArray = [];
if (strpos($linkHeader, ',') !== false) {
//Split into two or more elements by comma
$linkHeaderArr = explode(',', $linkHeader);
} else {
//Create array with one element
$linkHeaderArr[] = $linkHeader;
trajche / delete-all-products.php
Last active Jul 2, 2019 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
View delete-all-products.php
require dirname(__FILE__).'/wp-blog-header.php';
//Removing attributes (does not work for some reason, should read up on
$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)");
//Removing products and product variations
trajche / multiple-select-woocommerce.php
Created Mar 7, 2018
WooCommerce Product multiple select options
View multiple-select-woocommerce.php
function woocommerce_wp_select_multiple( $field ) {
global $thepostid, $post, $woocommerce;
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
$field['value'] = isset( $field['value'] ) ? $field['value'] : ( get_post_meta( $thepostid, $field['id'], true ) ? get_post_meta( $thepostid, $field['id'], true ) : array() );