Skip to content

Instantly share code, notes, and snippets.

View bjorn2404's full-sized avatar

Björn Holine bjorn2404

View GitHub Profile
@bjorn2404
bjorn2404 / locations-import.csv
Created January 17, 2021 22:08
Cardinal Locator CSV import structure
name description website address city state postal country hours1 hours2 hours3 hours4 hours5 hours6 hours7 phone email categories
@bjorn2404
bjorn2404 / functions.php
Last active January 27, 2021 20:39
ElasticPress exclude post type from "Weight results by date" decay
<?php
/**
* Filter the arguments sent to EP query
*
* @param array $formatted_args Formatted Elasticsearch query
* @param array $query_vars Query variables
* @param array $query Query part
*
* @return array
@bjorn2404
bjorn2404 / update.js
Created January 30, 2023 07:37
Gutenberg panel status in v6+ to solve: select( 'core/edit-post' ).getPreference is deprecated since version 6.0. Please use select( 'core/preferences' ).get instead.
/**
* Didn't find much documentation on how to fix this issue
*
* This pull request made the panels change: https://github.com/WordPress/gutenberg/commit/9a195fca8e0a23af1605830b4128edb116a4964a
*/
// Instead of using this approach to get a single panel status:
const addressPanelStatus = select( 'core/edit-post' ).getPreference( 'panels' )['cardinal-locator-location-address/location-address-panel'];
// Get all the open panels and use a simple indexOf. Ex:
@bjorn2404
bjorn2404 / format.md
Created January 26, 2024 05:41
CircleCI environment variable access token format for GitHub

After a GitHub access token is created/rotated a CircleCI Environment Variable may need to be updated using the following steps:

CircleCI > Project Settings > Environment Variables > Add Environment Variable

The COMPOSER_AUTH name is picked up automatically - if there's an existing one just click the "Add Enviornment Variable" button with the same name to replace.

Value format (replace with your token value):

{"github-oauth": {"github.com": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}}

@bjorn2404
bjorn2404 / function.php
Last active February 25, 2024 00:19
Search WordPress Gutenberg blocks for a specific block name in all nested innerBlocks data
<?php
/**
* Search blocks and innerBlocks for a specific type of block
*
* @param array $blocks Blocks to search through (use parse_blocks prior to passing).
* @param string $block_name The type of block to search for.
*
* @return array Matching blocks
*/