Advanced Search
Search Results
49 total results found
Filtering Block based content
Name Type Usage parse_blocks( string $content ) Function if you want to take a bunch of block attributes and store them in meta on save / generate stuff.More info pre_render_block Filter hook More info render_block Filter hook More...
WP-CLI create post with custom tax
wp mycpt create --tags='test1,test2' $tags = null; if ( isset( $assoc_args['tags'] ) ) { $tags = wp_parse_list( $assoc_args['tags'] ); unset( $assoc_args['tags'] ); } ... $command = "post create --porcelain " . assoc_args_to_str( $assoc_args ); $...
Persistent RAMDisk
Works on macOS Big Sur. Reference Persistence There is a non-deprecated way to do it: Open the Script Editor app. Paste do shell script "~/.login" on quit do shell script "~/.logout" continue quit end quit File > Save, Select Application a...
Push.Default Strategies
I was accidentally updating other branches when pushing my feature branch, and didn't realise why. Ever pushed to the wrong branch by mistake? what happens when you git push? Is your expectation that your local branch is pushed to the remote? This might not be...
Firefox Tweaks
Performance // speed up them sites network.dns.disablePrefetchFromHTTPS = false network.predictor.enable-prefetch = true network.http.max-persistent-connections-per-server = 12 Usability // Restore system print preview print.tab_modal.enabled = false Securit...
Auto linking project toolchains
If you use direnv you can automatically setup your project toolchain requirements. In the case of WordPress projects this typically includes composer, PHP, node, npm. Simply add the required php and composer version to the project's .envrc file: #example proje...
Smart audio output switching
Use a wrapper around DWeller's amazing switchaudiosource, to use partial matching to switch to an audio source by typing part of it's name: out Speak switches to Macbook Pro Speakers. I use the following script #!/usr/bin/env bash # Usage: ./out Speak if [ "$#...
Common questions
Why would you use onready var versus regular var? var is assigned when the script instance is created, if this is a node then it might not be added to the tree yet, so you can't use get_parent and similar on it. onready var is a shortcut for assigning vars ...
Hiding blocks from the block inserter
Hiding blocks allow the blocks to be used for existing content, but not for new content. function get_plugin_settings() { $disabled_blocks = []; $disabled_blocks[] = 'my/blockname'; return [ 'disabledBlocks' => $disabled_blocks, ]; } # enqueue scrip...
Static redirection
Inside a server block: # use ~* to match a string inside a hostname if ($host ~* 'living') { # temporary redirect rewrite ^/rewrite-test$ $scheme://$host/rewrite-test.html redirect; # permanent redirect rewrite ^/wp-content/uploads/2020/06/contact-u...
Troubleshooting
A connected event is not receiving the emitted signal Make sure the handler is accepting the same number of arguments. For example if the emitted signal adds a context argument, then the connected handler must also accept the context argument, otherwise it is ...
Curl commands
Time to first byte curl -s -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" "https://brain.vandragt.com/"
Backup and Restore Ubuntu based systems
Use apt-clone, deja-dup and some shell scripts to backup and restore ubuntu based systems: Requirements: Deja-Dup duplicity as a terminal command, if you want to restore that way. Backup sudo apt install apt-clone mkdir ~/backup cd ~/backup sudo apt-clone cl...
Installing wp-env
wp-env is pretty nice and the .wp-env.json file makes me think it's most of the way there as a generic local wp setup. of course it doesn't have redis / composer / support for multiple php versions, caching plugins, and dev tools installed with it. Requirement...
Cheatsheet
Intermediate React useState container for state within component (instance props). Use a store for data. useEffect Update render callback; update when something happens - async events. It's scheduled and you don't know when its going to run useContext gl...
Building PHP
OpenSUSE Ended up aborting this, but the notes might be handy for reference # Install phpenv curl -L https://raw.githubusercontent.com/phpenv/phpenv-installer/master/bin/phpenv-installer | bash # setup opensuse tumbleweed, php compiling required packages sudo...
Elementary OS Configuration and Setup
ElementaryOS 7 Horus Same wifi issue as [[OpenSUSE Tumbleweed]]. Same fix Mouse battery is seen as laptop battery, so battery power options apply. Zoom is fixed and keeps settings! Grub has no timeout $ sudo nano /etc/default/grub GRUB_TIMEOUT=5 PHPenv Use ...
LG TV
LG Slow program guide The best solution, as there seems to be nothing from LG , to create a Favourite channel,list with just the few needed, mine has 6 channels, once selected, the TV guide will use this and populate fairly quickly. This storage device cannot...
Local WagTail install on MultiPass
WAGTAIL INSTALL on multipass # Host multipass launch -n wagtail multipass shell wagtail # Guest sudo apt update sudo apt install python3.10-venv python3 -m venv mysite/env source mysite/env/bin/activate pip install wagtail wagtail start mysite mysite cd mysi...
WordPress Importer Plugin
It has support for: deduplication (see below), mapping image urls All imported posts haven import_id meta which is the ID they had in the import WXR. Post processing: Example /** * Usage: IMPORT_POST_TYPES=blogpost,attachment wp import ... */ WP_CLI::add_...