Skip to content

Instantly share code, notes, and snippets.

View david-binda's full-sized avatar

David Biňovec david-binda

View GitHub Profile
@david-binda
david-binda / bookmarklet.js
Last active June 12, 2019 09:15
Download image from PhotoVogue ( https://www.vogue.it/en/photovogue )
javascript:(function()%7B%20window.location%20=%20document.querySelector(%22%23galleryWrapper%20.carousel-content%20.item.active%20img%22).src%20%7D)();
@david-binda
david-binda / script.js
Created May 30, 2018 11:19
Console log cookies
console.log( document.cookie );
@david-binda
david-binda / vipgo_photonfill.php
Created August 2, 2017 15:15
VIP Go File service layer for Photonfill
<?php
/**
* VIP: make the Photonfill plugin working with the VIP Go file service instead of WPCOM's Photon.
*/
// Hijack the photonfill prefix.
add_filter( 'photonfill_hook_prefix', function( $prefix ) {
return 'vipgo';
} );
@david-binda
david-binda / apply-filters.php
Last active October 19, 2018 11:25
A must-use plugin for WordPress developers figuring out what filter callback changes a value passed to the `apply_filters` function
<?php
/*
Plugin Name: Apply Filters debug
Description: A debug function for figuring out what filter's callback changed the value
Version: 0.1
Author: Automattic, david-binda
Author URI: http://www.automattic.com/
*/
/* This program is free software; you can redistribute it and/or modify
@david-binda
david-binda / functions.php
Last active January 28, 2016 19:44
Asynchronous term object cache clearing for cases when term update times out.
<?php
//disable cache invalidation just before the term objects cache is cleared
function my_prefix_deactivate_cache_invalidation( $tt_id, $taxonomy ) {
//wp_suspend_cache_invalidation returns current status before it get's changed
$current_cache_suspend_status = wp_suspend_cache_invalidation( true );
//schedule asynchronous cache clearing
wp_schedule_single_event( time(), 'my_prefix_invalidate_term_objects_cache', array( $tt_id, $taxonomy ) );
1. Purpose
WordCamp CITYNAMEHERE believes our community should be truly open for everyone. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, disability, ethnicity, religion, preferred operating system, programming language, or text editor.
This code of conduct outlines our expectations for participant behavior as well as the consequences for unacceptable behavior.
We invite all sponsors, volunteers, speakers, attendees, and other participants to help us realize a safe and positive conference experience for everyone.
2. Open Source Citizenship
@david-binda
david-binda / log-deprecated-notices.patch
Created December 11, 2015 15:56
Patch for www/wp-content/plugins/log-deprecated-notices/log-deprecated-notices.php
--- log-deprecated-notices.php 2015-11-06 18:00:35.000000000 +0100
+++ log-deprecated-notices.php 2015-12-11 14:14:09.000000000 +0100
@@ -181,9 +181,17 @@
$hook = null;
$bt = 4;
// Check if we're a hook callback.
- if ( ! isset( $backtrace[4]['file'] ) && 'call_user_func_array' == $backtrace[5]['function'] ) {
- $hook = $backtrace[6]['args'][0];
- $bt = 6;
+ if ( ! isset( $backtrace[4]['file'] ) ) {
@david-binda
david-binda / functions.php
Last active October 1, 2015 17:51
Fieldmanager integration for Babble
<?php
add_action( 'init', function() {
//bail early as this should go to admin only
if ( ! is_admin() ) {
return;
}
new Babble_Translatable_Fieldmanager(
'Fieldmanager_TextField',
@david-binda
david-binda / wp_is_mobile_test.php
Last active August 29, 2015 14:14
wp_is_mobile performance test
<?php
function wp_is_mobile() {
/*static $is_mobile;
if ( isset($is_mobile) )
return $is_mobile;/* removed for performance testing purposes */
if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
$is_mobile = false;
} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.)
|| strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false
@david-binda
david-binda / register-message.php
Created January 31, 2015 23:34
Vlastní message na registrační stránce bez úpravy wp-login.php
<?php
/*
* následující kód vložte do souboru (libovolného jména) uvnitř adresáře /wp-content/mu-plugins (pokud neexistuje, vytvořte jej)
* více o mu-plugins zde: http://codex.wordpress.org/Must_Use_Plugins
* Kód bude fungovat i po vložení do functions.php, nicméně toto by, imho, mělo jít do mu-plugins
*/
add_filter( 'login_message', function( $message ) {
return $message . sprintf( '<p class="message register">%s</p>' , 'Nepište prosím diakritiku' );
} );