Skip to content

Instantly share code, notes, and snippets.

View JamoCA's full-sized avatar

James Moberg JamoCA

View GitHub Profile
@JamoCA
JamoCA / distrokid-genres.md
Last active June 6, 2026 02:31
Distrokid Genre Reference

DistroKid Genre Reference

Extracted from the DistroKid upload form markup. Genre IDs are the stable value keys submitted by the form. Both dropdowns share the same ID space.

Base Genres

All 43 base genres are available as a Primary genre. The Secondary dropdown offers the same list except Classical and Soundtrack, which are primary-only.

@JamoCA
JamoCA / markdownTableToQuery.cfm
Last active April 20, 2026 18:22
markdownTableToQuery UDF - Converts a markdown table string to a ColdFusion query with VARCHAR columns.
<cfscript>
/**
* Converts a markdown table string to a ColdFusion query with VARCHAR columns.
* James Moberg - 2026-04-17 myCFML.com / SunStarMedia.com
* https://gist.github.com/JamoCA/4bc3d41106b1da4f8511020985ecd350
* @markdown The markdown table string to parse.
* @return A query object with columns derived from the table header.
*/
public query function markdownTableToQuery(required string markdown) hint="Converts a markdown table to a CF query with VARCHAR columns" {
// Local closure: parses a single markdown row into an array of trimmed cells.
@JamoCA
JamoCA / queryReorder.cfm
Last active December 11, 2025 16:31
CFML UDF to reorders query rows based on an explicit list of ID values - ColdFusion / Lucee
<cfscript>
/**
* Reorders query rows based on an explicit list of ID values
* Uses a temporary sort column and Query-of-Queries for reordering
* 2025-12-05
* v1
* James Moberg - MyCFML.com https://www.myCFML.com/
* Sponsored by https://www.SunStarMedia.com/
* https://gist.github.com/JamoCA/4aba2a516a3d84a48255c3401d76b29f
* @param queryData The query to reorder
@JamoCA
JamoCA / TestCustomTag.cfm
Last active November 10, 2025 19:21
Call this as a custom tag using a CFTag or cfscript
<!---
11/10/2025 11:17:33
Custom Tag "thisTag" scope test.
Call this as a custom tag using a CFTag or cfscript
<cf_TestCustomTag>
or
cf_TestCustomTag();
--->
@JamoCA
JamoCA / Integer_Increment.cfm
Last active October 29, 2025 23:46
Integer increment test for Adobe ColdFusion, Lucee and BoxLang.
<cfscript>
// How do CFML platforms increase an integer? Is datatype/class faithfully retained?
// 2025-10-24 (Updated 2025-10-29 with more tests)
// by James Moberg - www.myCFML.com
// NOTE: Test this on TryCF.com (CFFiddle doesn't allow the use of getMetaData.)
test = [
"platform": (server.keyexists("boxlang")) ? "BoxLang" : server.coldfusion.productname,
x: javacast("int", 0)
];
@JamoCA
JamoCA / moduleTest.cfm
Last active October 6, 2025 23:13
Proof-of-concept CFML to contrast and compare CFModule / CFTag Execution Mode Behavior
<!--- 2025-10-06 15:22:49-07
In response to LinkedIn question from Ben Nadel:
https://www.linkedin.com/feed/update/urn:li:activity:7381052444270567425/
NOTE: All executions using "cftag (cfscript)" result in both start/end executions being triggered.
FIX: To avoid being double executed in cfscript, we modify the cftag/cfmodule to exit early if `thisTag.executionMode=end`
on implmentations that don't make use of `thisTag.GeneratedContent`.
--->
<cfparam name="url.TestType" default="cfml">
@JamoCA
JamoCA / invocationTests.cfm
Last active July 31, 2025 23:52
Check current template invocation mechanics (include vs module)
<!---
7/31/2025
Related to Adobe Tracker bug report CF-4227330 (https://tracker.adobe.com/#/view/CF-4227330)
--->
<!--- Add this check to the top of the script in case it's called using cfscript
or it will be executed twice as "self-closing cfscript" doesn't appear to be supported. --->
<cfif isdefined("thisTag.executionMode") && thisTag.executionMode eq "end">
<cfexit>
</cfif>
<!--- 2025-06-30 Passing Attributes via CFThread
TWEET: https://x.com/gamesover/status/1939722382379471155
The offical Adobe ColdFUsion example of passing attributes to a CFThread is not valid. In addition, it's not
a Short, Self Contained, Correct Example (SSCCE) that can be tested on TryCF.com or CFFiddle.org since it
requires access to the file system.
https://helpx.adobe.com/coldfusion/developing-applications/developing-cfml-applications/using-coldfusion-threads/using-thread-data.html#TheAttributesscopeandthreadattributes
OFFICAL EXAMPLE: Last updated on Jan 13, 2022
<cfloop query="dir">
@JamoCA
JamoCA / cfml-pdf-comparison.cfm
Last active April 10, 2025 00:13
Comparing ColdFusion CFDocument to WKHTMLTOPDF with GhostScript post-optimization
<!---
Comparing ColdFusion CFDocument to WKHTMLTOPDF with GhostScript post-optimization
2025-04-09
Requires WKHTMLTOPDF (LGPLv3; portable) https://wkhtmltopdf.org/
Requires GhostScript (GNU GPL Affero license; portable) https://www.ghostscript.com/
GIST: https://gist.github.com/JamoCA/b957c34cddea38f4bd2d777b41e348ac
Blog: https://dev.to/gamesover/pdf-generation-bloat-and-optimization-2118
Tweet: https://x.com/gamesover/status/1910123216972165226
LinkedIn: https://www.linkedin.com/posts/jamesmoberg_cfml-activity-7315889428340609024-5rEy
Test image from https://www.nasa.gov/image-detail/expedition-73-launch-3/
@JamoCA
JamoCA / pre-signed-wasabi-download-url.cfm
Last active March 20, 2025 15:59
CFML example code on how to generate a pre-signed Wasabi URL. (ColdFusion 2016+ compatible)
<cfscript>
/**
* generateS3PresignedUrl: Generates a pre-signed Wasabi URL (ColdFusion 2016+ compatible)
* documentation https://docs.wasabi.com/v1/docs/how-do-i-generate-pre-signed-urls-for-temporary-access-with-wasabi
* How to calculate: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
* @displayname generateS3PresignedUrl
* @author James Moberg http://sunstarmedia.com, @sunstarmedia
* @version 1
* @lastUpdate 3/20/2025
* @gist https://gist.github.com/JamoCA/bbdb652e4390898ea27eee489923ede3