Skip to content

Instantly share code, notes, and snippets.

@Scerno
Scerno / vanilla-js-xml-parser.js
Last active May 7, 2025 06:50
Lightweight dependency‑free XML → JSON parser in vanilla JavaScript
// Explanation here: https://scerno.com/scripting/parse-xml-to-json-lightweight-vanilla-js/
/**
* xmlToJson
* ---------
* Parse an XML string into an array of plain JS objects.
* Each piece of text is handled exactly once for efficiency.
*
* @param {string} xml A well‑formed XML string
* @return {Array<Object>}
@Scerno
Scerno / Create-Right-Angled-Line.jsx
Last active May 6, 2025 14:29
InDesign ExtendScript that converts any straight Graphic Line into a perfect orthogonal (“L”, “C” or “S”) leader with live preview.
// Explanation here: https://scerno.com/adobe/adobe-indesign-easy-right-angled-line-script/
/* SquareLineSelector.jsx
InDesign ExtendScript
v1.2 May 2025
Converts an angled line into orthogonal leader lines with optional three‑sided variant.
UI now uses a single numeric field + slider for distance; selector style/size removed.
*/
#target InDesign
@Scerno
Scerno / wordpress-add-url-to-woocommerce-export.php
Last active April 28, 2025 11:49
Adds a Product URL column to WooCommerce product exports without modifying the theme or website files.
<?php
// Explanation here: https://scerno.com/wordpress/wordpress-add-product-url-to-woocommerce-export/
// Add a new "Product URL" column header to the export file
add_filter( 'woocommerce_product_export_column_names', 'add_url_export_column' );
add_filter( 'woocommerce_product_export_product_default_columns', 'add_url_export_column' );
function add_url_export_column( $columns ) {
$columns['product_url'] = 'Product URL';
@Scerno
Scerno / Export studio images to named subfolders.bat
Created April 8, 2025 15:41
Use imagemagick to export multiple images to sub folders
@echo on
setlocal
:: Get the first and second arguments
set "target=%~1"
set "second=%~2"
:: Check if first argument exists
if "%target%"=="" (
echo Error: No folder was provided.