Skip to content

Instantly share code, notes, and snippets.

View getdave's full-sized avatar
🏖️
AFK - I may not respond for a while...

Dave Smith getdave

🏖️
AFK - I may not respond for a while...
View GitHub Profile
@getdave
getdave / bookmarklet-github-expand-all-load-more.js
Created June 2, 2020 10:56
Bookmarktlet to automatically expand all those "Load more..." links into your Github PRs.
javascript:(function()%7Bfunction%20githubLoadAllPRComments()%20%7B%0A%0A%20%20%20%20function%20recursiveExpandLoadMore()%20%7B%0A%0A%20%20%20%20%20%20%20%20%2F%2F%20Remove%20all%20existing%20timers%0A%20%20%20%20%20%20%20%20if(theTimeout)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20clearTimeout(theTimeout)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20const%20disabledLoadBtns%20%3D%20document.querySelector('.ajax-pagination-btn%5Bdisabled%5D')%3B%0A%0A%20%20%20%20%20%20%20%20%2F%2F%20If%20any%20buttons%20are%20already%20in%20the%20loading%20state%20then%20requeue%0A%20%20%20%20%20%20%20%20if(disabledLoadBtns)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20theTimeout%20%3D%20setTimeout(recursiveExpandLoadMore%2C%201000)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20const%20loadBtn%20%3D%20document.querySelector('.ajax-pagination-btn%3Anot(%5Bdisabled%5D)')%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%2F%2F%20If%20there%20are%20no%20more%20load%2
@getdave
getdave / tamper-monkey-expand-github-pr-comments.js
Last active March 17, 2022 11:40
A Tampermonkey script to automatically expand all those pesky folded Github PR comments.
// ==UserScript==
// @name Recursively expand Github PR comments
// @namespace http://aheadcreative.co.uk/
// @version 1.0
// @description Automatically expands all those pesky folded Github PR comments.
// @author Dave Smith (@getdave). Please contact for questions and feedback
// @match https://github.com/*/*/pull/*
// @copyright 2020, Ahead Creative
// @updateURL https://gist.githubusercontent.com/getdave/9b9087055decf6f6cb7bfada08fcd3d1/raw/
// ==/UserScript==
@getdave
getdave / gitrebasebranch.sh
Created March 22, 2021 11:06 — forked from aduth/gitrebasebranch.sh
Git - Interactive rebase against own merge base
#!/bin/bash
git rebase -i $(git merge-base HEAD master)
@getdave
getdave / imagesizes-wordpress-block-editor.js
Created October 20, 2022 12:19
Get registered image sizes in the WordPress block editor
import {store as blockEditorStore } from '@wordpress/block-editor';
import { useSelect } from "@wordpress/data";
// Inside component
const {sizes} = useSelect((select) => {
const { getSettings } = select(blockEditorStore);
const settings = getSettings();
const sizes = settings?.imageEditing?.imageSizes;
@getdave
getdave / book-review-pattern.php
Created October 24, 2022 10:23
Post Type Pattern in Gutenberg block editor WordPress
<?php
/**
* Title: Book Review
* Slug: twentytwentythree/book-review
* Categories: query
* Keywords: post meta
* Block Types: core/post-content
* Post Types: book
*/
?>