Skip to content

Instantly share code, notes, and snippets.

View BKeanu1989's full-sized avatar

Kevin Fechner BKeanu1989

View GitHub Profile
@BKeanu1989
BKeanu1989 / reset-mysql-root-pw.md
Created October 24, 2019 09:24
reset-mysql-root-pw

source: https://devanswers.co/how-to-reset-mysql-root-password-ubuntu/ #mysql 5.7

sudo /etc/init.d/mysql stop sudo mkdir /var/run/mysqld sudo chown mysql /var/run/mysqld

sudo mysqld_safe --skip-grant-tables& sudo mysql --user=root mysql mysql> update user set authentication_string=PASSWORD('your_password_here') where user='root';

function variation_settings_fields_rohartikel( $loop, $variation_data, $variation ) {
// Text Field
woocommerce_wp_text_input(
array(
'id' => '_rohartikel[' . $variation->ID . ']',
'label' => __( 'Rohartikelnummer Halle', 'woocommerce' ),
'placeholder' => '002015971001',
'desc_tip' => 'true',
'readonly' => true,
function woo_add_product_gender() {
echo '<div class="options_group">';
woocommerce_wp_select(
array(
'id' => '_product_gender',
'label' => __( 'Gender', 'woocommerce' ),
'options' => array(
'male' => __( 'Male', 'woocommerce' ),
@BKeanu1989
BKeanu1989 / test.php
Created May 6, 2019 22:26
date from Strings with fixed start & end date
<?php
$festivalStart = '2019-07-29';
$festivalEnd = '2019-08-04';
$germanDays = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'];
$englishDays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
function get_begin_N_end_from_time_span($timeSpanString)
{
preg_match('/(?P<begin>\w+).{0,3} (?P<end>\w+)/', $timeSpanString, $matches);
<?php
function delete_orders() {
global $wpdb;
$order_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->prefix}posts WHERE post_type = 'shop_order'");
foreach($order_ids AS $order_id) {
$order_id = (int) $order_id;
wp_delete_post($order_id, true);
}
/Applications/MAMP/bin/php/php7.1.22/bin/phpize --with-php-config=/Applications/MAMP/bin/php/php7.1.22/bin/php-config
<?php
/*
Plugin Name: Page Template Plugin : 'Good To Be Bad'
Plugin URI: http://www.wpexplorer.com/wordpress-page-templates-plugin/
Version: 1.1.0
Author: WPExplorer
Author URI: http://www.wpexplorer.com/
*/
class PageTemplater {
@BKeanu1989
BKeanu1989 / qwertee-show-all-prices.js
Created April 26, 2018 14:28
qwertee show all prices nerdy script
function showPrices() {
let prices = Array.from(document.querySelectorAll('.index-tee-list-item span.product-price'));
prices.forEach(function(price) {
price.style.display = "block";
})
}
function throttle(func, wait, options) {
var context, args, result;
var timeout = null;
function myplugin_plugin_path() {
// gets the absolute path to this plugin directory
return untrailingslashit( plugin_dir_path( __FILE__ ) );
}
add_filter( 'woocommerce_locate_template', 'myplugin_woocommerce_locate_template', 10, 3 );
@BKeanu1989
BKeanu1989 / functions.php
Last active February 15, 2018 18:39
write to log - wordpress debug log
if (!function_exists('write_log')) {
function write_log ( $log ) {
if ( true === WP_DEBUG ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
}
}