Skip to content

Instantly share code, notes, and snippets.

@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);
@shashankmehta
shashankmehta / setup.md
Last active November 18, 2024 18:33
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
@morsok
morsok / referer.php
Last active February 28, 2022 10:22
Drupal 8 : Do something based on the referer if it's your website or another.
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\Request;
function my_function() {
$previousUrl = \Drupal::request()->server->get('HTTP_REFERER');
$fake_request = Request::create($previousUrl);
$url_object = \Drupal::service('path.validator')->getUrlIfValid($fake_request->getRequestUri());
if ($url_object) {
$route_name = $url_object->getRouteName();
// Do something with $route_name;