Skip to content

Instantly share code, notes, and snippets.

@andfinally
andfinally / GitHub - click to copy link to PR or issue
Last active July 1, 2022 09:26
Greasemonkey script for GitHub pull requests and issues. Adds icon after title which, if clicked, copies the markup for a link to the PR to the clipboard
@andfinally
andfinally / greasemonkey-$-alias
Last active July 8, 2022 13:54
Greasemonkey script – adds $ and $$ aliases for querySelector and querySelectorAll
// ==UserScript==
// @name Make $ and $$ aliases for document.querySelector and document.querySelectorAll
// @version 1
// @description Creates aliases for document.querySelector and document.querySelectorAll
// @author andfinally
// @match https://github.com/*
// @match https://woocommerce.test/*
// @match https://*.woocommerce.com/*
// @grant none
// ==/UserScript==
@andfinally
andfinally / bookmarket-copy-doc-title-url.js
Last active July 11, 2022 12:14
Bookmarklet to copy document title and URL
// One-line version: create a bookmark with this content
// javascript:( function() { const jsIssueTitle = document.querySelector( '.js-issue-title' ); const title = jsIssueTitle ? jsIssueTitle.textContent : document.title; const blob = new Blob( [ `<a href="${ document.location.href }">${ title }</a>` ], { type: "text/html" } ); const clipboardItem = new ClipboardItem( { [ "text/html" ]: blob } ); navigator.clipboard.write( [ clipboardItem ] ); } )();
// Long version - only included here for legibility use the one-line version prefixed with `javascript:`
( function() {
// Get GitHub issue/PR title
const jsIssueTitle = document.querySelector( '.js-issue-title' );
const title = jsIssueTitle ? jsIssueTitle.textContent : document.title;
const blob = new Blob( [ `<a href="${ document.location.href }">${ title }</a>` ], { type: "text/html" } );
@andfinally
andfinally / promotions.json
Last active March 22, 2024 12:42
API test
[
{
"date_from_gmt": "2024-02-14 00:00",
"date_to_gmt": "2024-05-01 22:59",
"format": "notice",
"style": "info",
"pages": [
{ "page": "wc-admin", "path": "/extensions", "tab": "" },
{ "page": "wc-admin", "path": "/extensions", "tab": "extensions" },
{ "page": "wc-admin", "path": "/extensions", "tab": "themes" }
@andfinally
andfinally / promotions.json
Last active March 18, 2024 15:22
API test – expired items
[
{
"date_from_gmt": "2024-02-14 00:00",
"date_to_gmt": "2024-03-17 22:59",
"format": "notice",
"style": "info",
"pages": [
{ "page": "wc-admin", "path": "/extensions" },
{ "page": "wc-admin", "path": "/extensions", "tab": "extensions" },
{ "page": "wc-admin", "path": "/extensions", "tab": "themes" }
@andfinally
andfinally / promotions.json
Created March 21, 2024 10:53
API test – empty response
[]