Skip to content

Instantly share code, notes, and snippets.

@emdashcodes
emdashcodes / ada-obsidian-generic.md
Last active May 26, 2026 21:43
Slash command: open a Grimoire file in Obsidian via the Advanced URI plugin

Open a file in Obsidian.

If $ARGUMENTS is provided, open that file. Otherwise, look back through the conversation for the most recently referenced vault file path (e.g. from a Read, Write, or Edit tool call) and open that. If multiple files were created or edited in the same operation, open all of them. If no file can be found, just open the vault.

Use the Advanced URI plugin: open "obsidian://adv-uri?vault=YOUR_VAULT&filepath=<relative-path>&openmode=tab" where <relative-path> is the path relative to your vault root, including the .md extension. URL-encode spaces as %20.

When opening multiple files, issue separate open commands for each file. They will each open in a new tab.

If opening the vault with no file: open "obsidian://open?vault=YOUR_VAULT".

@emdashcodes
emdashcodes / enable-new-wc-onboarding.php
Created December 17, 2019 12:20
enable-new-wc-onboarding.php
<?php
/*
Plugin Name: Enable WooCommerce Onboarding Split Test
Description: Puts the site into the test group for WooCommerce Onboarding split testing.
Version: 1.0.0
Author: Automattic
License: GPL2
*/
function woocommerce_admin_set_test_group() {
return 'b';
@emdashcodes
emdashcodes / send-auto-update-debug-email.php
Created July 19, 2017 15:37
Sends debug emails for WP auto updates
<?php
/**
* Plugin Name: Send Automatic Update Debug Emails
* Description: Sends automatic Update Debug Emails
* Version: 0.1
*/
add_filter( 'automatic_updates_send_debug_email', '__return_true' );
@emdashcodes
emdashcodes / auto-update.php
Created June 28, 2017 18:50
Force auto update
<?php
// Force an auto update
require( dirname(__FILE__) . '/wp-load.php' );
delete_option( 'auto_updater.lock' );
wp_maybe_auto_update();
<?php
/**
* Legacy Customers API Tests
* @package WooCommerce\Tests\API
*/
class WC_Tests_API_Legacy_Customers extends WC_API_Unit_Test_Case {
/** @var WC_API_Customers instance */
protected $endpoint;
@emdashcodes
emdashcodes / wc-refund-item-info.php
Last active February 21, 2017 18:56
WooCommerce: Get item info from refunds
<?php
// Get items from all refunds
$refunds = array();
$refund_items = get_posts( array(
'post_type' => 'shop_order_refund',
'posts_per_page' => -1,
'post_status' => 'any',
'fields' => 'ids'
) );
@emdashcodes
emdashcodes / woocommerce-cancel-unpaid-bookings.php
Created November 2, 2015 16:04
Allows WooCommerce booking orders to be canceled by the cancel unpaid orders cron job.
<?php
/*
* Plugin Name: Cancel Unpaid Bookings
* Author: WooThemes
* Description: Allows booking orders to be canceled by the cancel unpaid orders cron job.
*/
// woocommerce-cancel-unpaid-bookings.php
function woocommerce_cancel_unpaid_booking_orders_from_admin( $return, $order ) {