Skip to content

Instantly share code, notes, and snippets.

View lukasbesch's full-sized avatar

Lukas Besch lukasbesch

View GitHub Profile
@lukasbesch
lukasbesch / wp-rest-blocks-empty-editor-fix.php
Last active October 12, 2022 18:12
WP REST Blocks – Empty editor fix
<?php
/**
* Plugin Name: WP REST Blocks – Empty editor fix
* Plugin URI: https://gist.github.com/lukasbesch/ed9cdd5c7df0eb620b2b9cb48fd7935c
* Description: Fixes the empty editor issue with the »WP REST Blocks« plugin on WordPress 5.9+. See https://github.com/spacedmonkey/wp-rest-blocks/issues/31
* Version: 0.1.0
*
* @see https://github.com/spacedmonkey/wp-rest-blocks/issues/31
*/
@lukasbesch
lukasbesch / disk-conversion-progress.sh
Last active March 31, 2022 15:52
View progress of long-running disk conversion tasks (en-/decryption) on macOS / OS X
function displaytime {
local T=$1
local D=$((T/60/60/24))
local H=$((T/60/60%24))
local M=$((T/60%60))
local S=$((T%60))
(( $D > 0 )) && printf '%3s' $D && printf ' days '
(( $H > 0 )) && printf '%2s' $H && printf ' hours '
(( $M > 0 )) && printf '%2s' $M && printf ' minutes '
if [ $D -lt 1 -a $H -lt 1 ]
@lukasbesch
lukasbesch / acf-field-wysiwyg-character-counter.php
Last active January 27, 2022 20:58
Character counter for ACF WYSIWYG Field
/* For usage with acf_form() */
function my_acf_wysiwyg_character_counter() {
?>
<script type="text/javascript">
acf.add_filter('wysiwyg_tinymce_settings', function(mceInit) {
mceInit.elementpath = false;
mceInit.setup = function(ed) {
var characterLimit = 800,
edContainer,