Skip to content

Instantly share code, notes, and snippets.

View hjanuschka's full-sized avatar
🤖
-.-

Helmut Januschka hjanuschka

🤖
-.-
  • Vienna/Austria
View GitHub Profile
# BLACKFIRE.io setup
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& wget -O /tmp/blackfire-probe.tar.gz https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
&& mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini
@hjanuschka
hjanuschka / README.md
Last active November 23, 2018 18:57
unittests against ClassicPress

Setup testing environment

ClassicPress

bin/install-cp-tests.sh  DBNAME DBUSER DBPASS DBIP:DBPORT master false

master == the version

@hjanuschka
hjanuschka / PrettyPrinter.php
Created November 22, 2018 10:36
phpunit pretty print
<?php
namespace Test;
class PrettyPrinter extends \PHPUnit\TextUI\ResultPrinter implements \PHPUnit\Framework\TestListener
{
private $headerPrinted = false;
/**
* Function name is slightly deceiving because it is called at the beginning of the
* unit test summary (after all tests have run)
*/
@hjanuschka
hjanuschka / media-views.js
Created August 14, 2018 08:06
media-views.js compat indicator
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
<?php
acf_add_local_field_group(array(
'key' => 'group_5878908956b61',
'title' => __('Media: Copyright', 'kmm-media'),
'fields' => array(
array(
'key' => 'field_587890c1ce938',
'label' => __('Copyright', 'kmm-media'),
'name' => 'copyright',
array (
'key' => 'field_585149317aa44',
'label' => 'Fixposition',
'name' => 'ressort_template_position',
'type' => 'ressort_picker',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '10%',
acf-input.min.js?ver=5.7.2&decache=v0.0.635:1 Uncaught TypeError: Cannot read property 'collapsedRows-1751201' of null
at Object.e.getPreference (acf-input.min.js?ver=5.7.2&decache=v0.0.635:1)
at acf.Model.load (acf-pro-input.min.js?ver=5.7.2&decache=v0.0.635:1)
at i.addCollapsed (acf-pro-input.min.js?ver=5.7.2&decache=v0.0.635:1)
at initialize (acf-pro-input.min.js?ver=5.7.2&decache=v0.0.635:1)
at i.t (acf-input.min.js?ver=5.7.2&decache=v0.0.635:1)
at i.acf.Model (acf-input.min.js?ver=5.7.2&decache=v0.0.635:1)
at i [as constructor] (acf-input.min.js?ver=5.7.2&decache=v0.0.635:1)
at new i (acf-input.min.js?ver=5.7.2&decache=v0.0.635:1)
at Object.acf.newField (acf-input.min.js?ver=5.7.2&decache=v0.0.635:1)
#!/usr/bin/perl
use Getopt::Long;
use Switch;
use Net::Statsd;
$Net::Statsd::HOST = 'stats.krn.krone.at'; # Default
$Net::Statsd::PORT = 8125; # Default
%options = (
'help' => 0,
'cache' => 0,
<?php
/*
ACF - even when used with json/php files only, has the problem that it triggers a wpquery
that does not scale if you reach a certain amount of wp_post's.
to bypass this, we hook into posts_pre_query and disable the ACF lookup that is slow.
this DISABLES to ability to use DB stored acf settings, you'd need to load the json/php files.
to provide a little bit better DEV-XP - you can bypass this bypass :D - with WP_DEBUG=true
*/
add_filter('posts_pre_query', array( $this, 'acf_posts_pre_query' ), 15, 2);
# master slave replica.
https://github.com/bitnami/bitnami-docker-mysql/blob/master/docker-compose-replication.yml
# mysql-proxy with rw-splitting.
https://github.com/vimagick/dockerfiles/blob/master/mysql-proxy/docker-compose.yml
use rwsplitting.lua and set ` --proxy-backend-addresses` to the master/writeable nodes.
and `--proxy-read-only-backend-addresses` to the read replicas.