Skip to content

Instantly share code, notes, and snippets.

@chrismccoy
chrismccoy / gitcheats.txt
Last active October 16, 2024 15:36
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# sort list of git repos with gh cli
gh repo list --limit 300 --json name -q '.[].name' | sort
# count total commits in a repo
git rev-list --all --count
@chrismccoy
chrismccoy / restapi.txt
Last active October 28, 2024 06:18
WordPress REST API Resources
Disable REST Api without Plugins
https://rudrastyh.com/wordpress/disable-rest-api.html
Add featured image & alt text to WP REST API
https://allisontarr.com/2021/10/13/add-featured-image-alt-text-to-wp-rest-api/
Allow ALL cross origin requests to WordPress REST API
https://github.com/Shelob9/rest-all-cors
WordPress theme using Rest API and Vue.js
@chrismccoy
chrismccoy / gutenberg.txt
Last active November 9, 2024 03:32
Gutenberg Resources
Eliminate All Blocks from Editor
wp.data.dispatch( 'core/block-editor' ).resetBlocks([]);
Filtering Blocks When allowed_block_types_all is a boolean
https://tomjn.com/2024/02/29/filtering-blocks-when-allowed_block_types_all-is-a-boolean/
Gutenberg / Block editor: Dynamically populate SelectControl, RadioControl or CheckboxControl options
https://bdwm.be/gutenberg-block-editor-dynamically-populate-selectcontrol-radiocontrol-or-checkboxcontrol-options/
Gutenberg: custom validation / how to prevent post from being saved