Skip to content

Instantly share code, notes, and snippets.

View laryn's full-sized avatar

Laryn laryn

View GitHub Profile
@laryn
laryn / replace_smartobject_image.js
Last active February 20, 2024 17:38
Photoshop script to replace a smart object within a PSD with selected image(s) and save result as a JPG. (Transformations to the smart object will be applied to new images).
// Replace SmartObject’s Content and Save as JPG
// 2017, use it at your own risk
// Via @Circle B: https://graphicdesign.stackexchange.com/questions/92796/replacing-a-smart-object-in-bulk-with-photoshops-variable-data-or-scripts/93359
// JPG code from here: https://forums.adobe.com/thread/737789
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var theName = myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var thePath = myDocument.path;
@laryn
laryn / default-commerce-size-color-display-snippet.php
Created November 3, 2017 15:27
Setting a global default size and color in Drupal Commerce product displays.
/*********************************************************************************
* Setting a global default size and color in Drupal Commerce product displays.
*
* Include this in your custom module (renaming the function appropriately),
* it is not a full custom module on its own.
*********************************************************************************/
function MYMODULE_commerce_product_reference_default_delta_alter(&$delta, $products) {
$firstproduct = reset($products);
@laryn
laryn / .lando.yml
Last active January 2, 2023 18:42
Opinionated Backdrop + XDebug Lando sandbox configuration file
# Opinionated Lando + Backdrop + XDebug sandbox configuration file.
name: sandbox
# Use existing Backdrop recipe, then customise below.
recipe: backdrop
config:
# Where Backdrop resides, relative to this file.
webroot: web
# Prefer MariaDB over MySQL.

Backdrop Core Merging Guidelines

Set up your repo for committing

Check your Git config settings to ensure you have the right name/email for your committing process.

git config --get-regexp user
@laryn
laryn / convert-fc2p.php
Created October 11, 2023 15:27 — forked from herbdool/convert-fc2p.php
Convert Field Collection to Paragraph
<?php
/**
* Convert Field Collection to Paragraphs
*
* bee php-script convert-fc2p.php
*
* @todo add batching.
*
* - Both field_collection and paragraphs need to be enabled.
@laryn
laryn / convert-d7media2backdrop.php
Created October 26, 2023 16:22 — forked from herbdool/convert-d7media2backdrop.php
Convert D7 Media to Backdrop Media
<?php
/**
* Convert d7 media to Backdrop media
*
* bee php-script convert-d7media2backdrop.php
*
* @todo add batching.
*/