Skip to content

Instantly share code, notes, and snippets.

[
{
"date_from_gmt": "2024-02-14 00:00",
"date_to_gmt": "2025-05-01 00:00",
"format": "notice",
"style": "info",
"pages": [
{ "page": "wc-admin", "path": "/extensions", "tab": "" },
{ "page": "wc-admin", "path": "/extensions", "tab": "themes" }
],
@andfinally
andfinally / promotions.json
Created March 21, 2024 10:53
API test – empty response
[]
@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" }
[
{
"date_from_gmt": "2024-02-14 00:00",
"date_to_gmt": "2024-05-13 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 / 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 / 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 / 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 / calypso-anybar-handler.sh
Last active April 25, 2018 17:22 — forked from mcsf/calypso-anybar-handler.sh
Calypso AnyBar handler
#!/bin/bash
PORT="${PORT:-1738}"
DONE_COLOR="${DONE_COLOR:-"green"}"
PROGRESS_COLOR="${PROGRESS_COLOR:-"orange"}"
INITIAL_COLOR="${INITIAL_COLOR:-"white"}"
BUILD_ERROR_COLOR="${BUILD_ERROR_COLOR:-"red"}"
TEST_ERROR_COLOR="${TEST_ERROR_COLOR:-"purple"}"
HAS_ERROR=0
import gulp from 'gulp';
import sass from 'gulp-sass';
import babel from 'gulp-babel';
import sourcemaps from 'gulp-sourcemaps';
import es from 'event-stream';
import rename from 'gulp-rename';
import uglify from 'gulp-uglify';
const sassOpts = {outputStyle: 'compressed', errLogToConsole: true};
@andfinally
andfinally / sample.js
Last active February 4, 2017 15:49 — forked from gfazioli/old_version_event.js
WordPress actions and filters in Javascript Forked from gfazioli/old_version_event.js.
// Add action
wpdk_add_action( 'test_action', test_action );
// Action function
function test_action()
{
console.log( 'Fires test_action' );
}
wpdk_do_action( 'test_action' );