Skip to content

Instantly share code, notes, and snippets.

View trajche's full-sized avatar
🍕
Hungry

Trajche TJ Kralev trajche

🍕
Hungry
  • Helsinki, Finland
View GitHub Profile
@trajche
trajche / index.html
Last active September 8, 2015 17:48
HTML5 Boilerplate
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<title></title>
<meta content="" name="description">
<meta content="width=device-width, initial-scale=1" name="viewport">
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css"rel="stylesheet">
@trajche
trajche / pptx_progress_bar.vba
Last active October 19, 2015 11:41
Progress bar for a Powerpoint in VBA
Sub ProgressBar()
On Error Resume Next
With ActivePresentation
For X = 1 To .Slides.Count
.Slides(X).Shapes("PB").Delete
Set s = .Slides(X).Shapes.AddShape(msoShapeRectangle, _
0, 0, _
X * .PageSetup.SlideWidth / .Slides.Count, 18)
s.Fill.ForeColor.RGB = RGB(63, 153, 209)
s.Line.Visible = 0
@trajche
trajche / delete_user_select_inheritance.js
Created October 19, 2015 19:27
Select new author to inherit posts, when deleting user from website
jQuery( "input#delete_option1" ).each(function() {
jQuery( this ).attr("checked","checked");
});
jQuery( "select#reassign_user" ).each(function() {
jQuery( this ).val("81");
});
@trajche
trajche / WordPress Custom Global Variables.md
Created October 27, 2015 05:27 — forked from aahan/WordPress Custom Global Variables.md
Creating and using custom global variables in wordpress.

First create global variables (in functions.php or as a mu-plugin):

<?php

/*
 * CUSTOM GLOBAL VARIABLES
 */
function wtnerd_global_vars() {
@trajche
trajche / sources.list
Created December 15, 2015 04:20
Adding Proxmox repository for Debian 8.2 Jessie
deb http://mirror.hetzner.de/debian/packages jessie main contrib non-free
deb http://http.debian.net/debian jessie main contrib non-free
deb http://http.debian.net/debian/ jessie-updates main contrib non-free
deb http://download.proxmox.com/debian jessie pve-no-subscription
deb http://security.debian.org/ jessie/updates main contrib non-free
@trajche
trajche / woocomerce_clean
Last active May 15, 2018 13:51 — forked from ScottDeLuzio/mysql_query
MySQL query remove Woocommerce sessions & transients
DELETE FROM wp_options WHERE option_name LIKE '_wc_session_%' OR option_name LIKE '_wc_session_expires_%';
DELETE FROM wp_options WHERE option_name LIKE '_transient_wc_%' OR option_name LIKE '_transient_timeout_wc_%';
@trajche
trajche / countries.html
Created January 20, 2017 10:27
salesforce country list
<select id="con18country" name="con18country" tabindex="26">
<option value="">
--None--
</option>
<option value="AF">
Afghanistan
</option>
<option value="AX">
Aland Islands
</option>
@trajche
trajche / multiple-select-woocommerce.php
Created March 7, 2018 13:51
WooCommerce Product multiple select options
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() );
@trajche
trajche / delete-all-products.php
Last active July 2, 2019 09:35 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
<?php
require dirname(__FILE__).'/wp-blog-header.php';
//Removing attributes (does not work for some reason, should read up on https://www.webhat.in/article/woocommerce-tutorial/how-product-attribute-are-stored-in-database/)
$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
trajche / headerparser.php
Last active November 5, 2019 19:56
link rel parser for headers in shopify / github
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;