Skip to content

Instantly share code, notes, and snippets.

View shanonplace's full-sized avatar
🏠
feeding stray cats in Portland Oregon

Shanon Place shanonplace

🏠
feeding stray cats in Portland Oregon
View GitHub Profile
import * as dotenv from "dotenv";
import fetch from "node-fetch";
dotenv.config();
const workflowId = "3THnDj08TlJBoAM5oJofWn"; //for the GET request
const originEnvironment = "Workflow-Test";
const destinationEnvironment = "master";
//get a workflow definition from the origin environment
const workflowJson = await getWorkflowDefinition(workflowId, originEnvironment);
@shanonplace
shanonplace / gist:10cf606630e0811dbb157817fa24ccb4
Created February 28, 2025 22:46
Find all encoded strings from Contentful Live Preview Inspector Mode
// Run this script in the browser console to get all strings with zero-width characters in the DOM.
// Copy them to and file and then use methods in index to validate and decode them.
const zeroWidthRegex = /[\u200B-\u200D\u200E\u200F\uFEFF]/;
const stringsWithZeroWidth = [...document.querySelectorAll("*")]
.flatMap((element) => [...element.childNodes])
.filter(
(node) =>
node.nodeType === 3 &&
@shanonplace
shanonplace / move-workflow-between-environments.mjs
Last active April 10, 2025 15:45
Example script to copy a workflow definition from one environment to another in Contentful.
import * as dotenv from "dotenv";
import fetch from "node-fetch";
dotenv.config();
const workflowId = "3THnDj08TlJBoAM5oJorrrrfWn"; //These three could be .env file strings or cli params
const originEnvironment = "Workflow-Test";
const destinationEnvironment = "master";
//get a workflow definition from the origin environment
const workflowJson = await getWorkflowDefinition(workflowId, originEnvironment);