Skip to content

Instantly share code, notes, and snippets.

@toricls
toricls / lima-on-m1-mac-installation-guide.md
Last active November 9, 2024 23:03
Using Lima to run containers with containerd and nerdctl (without Docker Desktop) on M1 Macs

Lima (Linux virtual machines, on macOS) installation guide for M1 Mac.

Sep. 27th 2021 UPDATED

Now we can install patched version of QEMU via Homebrew (thank you everyone for the info!). Here is the updated instruction with it:

Used M1 Mac mini 2020 with macOS Big Sur Version 11.6.

1. Install QEMU & Lima

@fwazeter
fwazeter / readme.md
Last active March 16, 2022 21:03
Make WordPress Core Theme Mimic Gutenberg / FSE .HTML template rendering with multiple post type support.

Overview

Author: Frank Wazeter Author URL: https://wazeter.com

WordPress 5.8 marks a big step towards Full Site Editing and using Block Themes vs. traditional (classic) themes powered primarily by PHP template files. However, using currently experimental features in production is extremely risky due the developmental nature. This code shows how a WordPress theme can support and mimic Gutenberg Plugin's templating system for the block editor/template editor, while not having a dependency on the Gutenberg Plugin itself. Most existing references or documentation have a dependency of some kind on the Gutenberg plugin to make it work.

If full site editing is only fully available in testing, why implement features now in a WordPress classic theme?

The future is undeniably wrapped around full site editing - that everything can be manipulated through blocks and corresponding

@KevinBatdorf
KevinBatdorf / gutenberg-helpers.js
Last active March 20, 2025 13:39
WordPress check Gutenberg editor is ready
import { select, subscribe } from '@wordpress/data'
export function whenEditorIsReady() {
return new Promise((resolve) => {
const unsubscribe = subscribe(() => {
// This will trigger after the initial render blocking, before the window load event
// This seems currently more reliable than using __unstableIsEditorReady
if (select('core/editor').isCleanNewPost() || select('core/block-editor').getBlockCount() > 0) {
unsubscribe()
resolve()
@jonbrockett
jonbrockett / functions.php
Created June 10, 2021 14:10
Disable Searching for an Empty String in WordPress Search
/** Show 'Nothing Found' for an empty search instead of all posts/pages (Helps with Accessibility) */
require_once 'library/search-empty-disable.php';
<?php
/**
* Plugin or functions.php
*/
function mxd_csp_nonce() {
// generate nonce here
return 'sha384-7TB/burIFPND3rU7p38KUmP8C6LhM+Ybd8yzSEb1FvUgyJd9TMJ9HqWP3q+sFZOM';
}
@broofa
broofa / checkForUndefinedCSSClasses.js
Last active January 21, 2024 17:22
ES module for detecting undefined CSS classes (uses mutation observer to monitor DOM changes). `console.warn()`s undefined classes.
/**
* Sets up a DOM MutationObserver that watches for elements using undefined CSS
* class names. Performance should be pretty good, but it's probably best to
* avoid using this in production.
*
* Usage:
*
* import cssCheck from './checkForUndefinedCSSClasses.js'
*
* // Call before DOM renders (e.g. in <HEAD> or prior to React.render())
@justintadlock
justintadlock / functions.php
Created April 29, 2021 14:23
Remove block-templates support from Gutenberg.
<?php
// Drop the below in theme functions.php.
add_action( 'after_setup_theme', function() {
remove_theme_support( 'block-templates' );
} );
@hhhonzik
hhhonzik / deploy.yml
Last active March 27, 2025 14:28
Kinsta Deployment
# Kinsta Deployment through Github Actions for Bedrock/Sage.
#
# Placed at: .github/workflow/deploy.yml
#
# Process should be studied from code, but some quick brief:
# - runs composer / sage installation
# - moves correct `.env.*` file for multiple configs
# - uses rsync to sync files, uses /.rsyncignore file to exclude whatever should not be there
# - symlinks uploads folder and symlink release folder to kinsta public hostname
# - if you want to clear cache, please uncomment the last job
@skyshab
skyshab / example.php
Created March 30, 2021 13:17
Restore shortcode functionality on the Community Events page
<?php
add_action( 'tribe_events_community_form', function( $event_id, $event, $template ){
add_filter( 'the_content', 'do_shortcode', 999 );
}, 100, 3);

As far as I can tell, you can't do it conveniently. That is, git-rebase does not give you an option to preserve the committer date. Unless you give the --ignore-date (or its alias, --reset-author-date) option, it will always preserve the author date. However, there is no way to make git-rebase preserve the committer date, unless some manual script is crafted.

The best you can do is to make the committer date equal to the author date. Recently (in 2020 Q4), git-rebase --interactive has gained the ability to use the --committer-date-is-author-date flag with the interactive rebase. Before that, there was no way of influencing the committer date at all with the interactive rebase. Note that this flag does not preserve the committer date. It merely makes the committer date equal to the author date.

You might be thinking "well, isn't that effectively preserving the committer date, since normally the committer date is always equal to the author date?". Normally, you would be correct. However, there