Skip to content

Instantly share code, notes, and snippets.

Michal Zuber mikaelz

Block or report user

Report or block mikaelz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mikaelz
mikaelz / mother-day.ics
Created May 1, 2019
ICS Calendar event with Mother's day in Hungary
View mother-day.ics
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
RRULE:FREQ=YEARLY;BYMONTH=5;BYDAY=1SU
SUMMARY:Mother day in Hungary
DTSTART;VALUE=DATE:20190101
SEQUENCE:0
DESCRIPTION:
END:VEVENT
END:VCALENDAR
View docker-compose.yml
version: "3.2"
services:
wordpress:
image: wordpress
volumes:
- type: volume
source: www-data
target: /var/www/html
expose:
- 80
@mikaelz
mikaelz / get_time_from_ntp.php
Created Sep 17, 2018 — forked from bohwaz/get_time_from_ntp.php
Fetches timestamp from a NTP server in PHP
View get_time_from_ntp.php
<?php
/**
* Returns UNIX timestamp from a NTP server (RFC 5905)
*
* @param string $host Server host (default is pool.ntp.org)
* @param integer $timeout Timeout in seconds (default is 10 seconds)
* @return integer Number of seconds since January 1st 1970
*/
function getTimeFromNTP($host = 'pool.ntp.org', $timeout = 10)
View run-traefik.sh
docker run --rm -l traefik -p 8080:8080 -p 80:80 \
-v $PWD/traefik.toml:/etc/traefik/traefik.toml \
-v /var/run/docker.sock:/var/run/docker.sock traefik
@mikaelz
mikaelz / docker-etc-hosts
Created Jul 26, 2018 — forked from Zaffy/docker-etc-hosts
Docker: print ips and containers' names suitable for use in /etc/hosts
View docker-etc-hosts
for i in `docker ps -a -q | awk '{print $1}'`; do echo $(docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" $i) $(docker ps | grep $i | awk '{print $NF}') ; done
@mikaelz
mikaelz / add_magazin_link_to_breadcrumbs.php
Created May 2, 2018
Add custom list item to Breadcrumbs NavXT
View add_magazin_link_to_breadcrumbs.php
@mikaelz
mikaelz / fix-embed-shortcode.php
Created Apr 10, 2018
Fix rendering of YouTube player of link in do_shortcode
View fix-embed-shortcode.php
<?php
// Hack due https://core.trac.wordpress.org/ticket/23431 issue
$embed = new WP_Embed();
$content = $embed->run_shortcode( $wp_query->queried_object->description );
echo '<div class="category-description">' . do_shortcode( $content ) . '</div>';
@mikaelz
mikaelz / functions.php
Created Mar 31, 2018
Remove Products list item from Breadcrumb NavXT
View functions.php
/**
* Remove products breadcrumb
*
* @param object $breadcrumb_obj Breadcrumb object.
*/
function my_bcn_after_fill( $breadcrumb_obj ) {
if ( is_category() || is_tag() || is_tax() ) {
foreach ( $breadcrumb_obj->breadcrumbs as $key => $item ) {
if ( 'Products' === $item->get_title() ) {
unset( $breadcrumb_obj->breadcrumbs[ $key ] );
@mikaelz
mikaelz / class-pie-wcwl-waitlist-mailout.php
Created Nov 2, 2017
Fix waitlist allowed memory limit error
View class-pie-wcwl-waitlist-mailout.php
diff --git a/wp-content/plugins/woocommerce-waitlist/classes/class-pie-wcwl-waitlist-mailout.php b/wp-content/plugins/woocommerce-waitlist/classes/class-pie-wcwl-waitlist-mailout.php
index e77ed03..2e41933 100644
--- a/wp-content/plugins/woocommerce-waitlist/classes/class-pie-wcwl-waitlist-mailout.php
+++ b/wp-content/plugins/woocommerce-waitlist/classes/class-pie-wcwl-waitlist-mailout.php
@@ -83,6 +83,9 @@ if ( ! class_exists( 'Pie_WCWL_Waitlist_Mailout' ) ) {
public function add_user_to_archive( $product_id, $user_id ) {
$existing_archives = get_post_meta( $product_id, 'wcwl_waitlist_archive', true );
$today = strtotime( date( "Ymd" ) );
+ if (empty($existing_archives)) {
+ $existing_archives = array();
@mikaelz
mikaelz / add-woocommerce-category-to-menu.php
Created Oct 4, 2017
Create WooCommerce product category menu entry
View add-woocommerce-category-to-menu.php
<?php
$args = array(
'menu-item-object-id' => $term['term_id'],
'menu-item-object' => 'product_cat',
'menu-item-parent-id' => 0,
'menu-item-type' => 'taxonomy',
'menu-item-status' => 'publish',
);
$res = wp_update_nav_menu_item( MENU_ID, 0, $args );
You can’t perform that action at this time.