Skip to content

Instantly share code, notes, and snippets.

Working from home

Nicki Hastings nickihastings

Working from home
View GitHub Profile
rrennick / fix-as-action-ids.php
Last active Oct 3, 2020
Address fatal error in Action Scheduler when identity field was not correctly set on migration
View fix-as-action-ids.php
Plugin Name: Fix Action Scheduler Action IDs
Version: 0.2
Author: Automattic
Author URI:
Description: This is a one time use plugin designed to address a fatal error during AS migration where the identity field in the actionscheduler_actions table did not get set before actions were migrated.
License: GNU General Public License v3.0 (or later)
License URI:
eduwass / aux-functions.php
Last active May 2, 2022
Programmatically duplicating a WordPress post
View aux-functions.php
* Duplicates a post & its meta and it returns the new duplicated Post ID
* @param [int] $post_id The Post you want to clone
* @return [int] The duplicated Post ID
function duplicate($post_id) {
$title = get_the_title($post_id);
$oldpost = get_post($post_id);
dsernst / heapsPermute.js
Last active May 15, 2018
A JavaScript implement of Heap's efficient Permutation Algorithm:
View heapsPermute.js
var swap = function (array, pos1, pos2) {
var temp = array[pos1];
array[pos1] = array[pos2];
array[pos2] = temp;
var heapsPermute = function (array, output, n) {
n = n || array.length; // set n default to array.length
if (n === 1) {