Skip to content

Instantly share code, notes, and snippets.

View bennadel's full-sized avatar
💭
Life's a garden, dig it!

Ben Nadel bennadel

💭
Life's a garden, dig it!
View GitHub Profile
@bennadel
bennadel / test.cfm
Last active May 11, 2023 11:22
Testing jSoup stuff in Admin
<cfoutput>#coolBeans#</cfoutput>
<cfdump var="request" abort="true" />
This is interesting. But, it needs to be updated.
@bennadel
bennadel / BugSnagApiClient.cfc
Last active May 10, 2023 13:10
Using BugSnag As A Server-Side Logging Service In ColdFusion
component
output = false
hint = "I report server-side errors to the BugSnag API."
{
/**
* I initialize the BugSnag API client.
*/
public void function init( required string apiKey ) {
@bennadel
bennadel / Checkbox.cfm
Created May 7, 2023 14:34
Importing Multiple ColdFusion Custom Tag Directories Using The Same Prefix
<div>
<mark>[Checkbox]</mark>
</div>
@bennadel
bennadel / MyTag.cfm
Created May 7, 2023 11:44
ColdFusion Custom Tags Can Use Dashed Attributes
<cfdump var="#attributes#" />
<cfabort />
@bennadel
bennadel / test.js
Last active May 6, 2023 10:21
This is a gist test
var x = "noice!";
@bennadel
bennadel / authenticated.cfm
Created April 29, 2023 20:52
Handling 401 Unauthorized Responses In Turbo Drive And ColdFusion
<cfscript>
// For the sake of simplicity, all the "logged-in" pages will be rendered as this
// page, using the "v" value to differentiate.
param name="url.v" type="string" default="home";
</cfscript>
<cfmodule template="./tags/page.cfm">
<cfoutput>
@bennadel
bennadel / index.cfm
Created April 18, 2023 11:49
Selecting Portions Of A Turbo Stream Template With Custom Actions
<cfmodule template="./tags/page.cfm">
<cfoutput>
<div id="demo-container">
<p class="original">
To be changed via Turbo Streams.
</p>
</div>
<!---
@bennadel
bennadel / index.cfm
Created April 15, 2023 13:05
Accessing Stimulus Controllers From A Given DOM Element In Hotwire
<cfmodule template="./tags/page.cfm">
<cfoutput>
<!--- Parent controller. --->
<form data-controller="form">
<!---
The textarea controller has methods for manipulating the text value in
low-level ways so that the complexity of text manipulation doesn't have to
leak up and out into the form itself. This also increases the ability to
@bennadel
bennadel / snippet-1.cfm
Created April 14, 2023 12:42
Building Resilient Feature Flags That "Fail Open" In ColdFusion
<cfscript>
apiResponse = serializeJson({
// ... truncated ....
featureFlags: {
canSeeDuplicate: true // This feature is now ENABLED for this user!
}
});
</cfscript>
@bennadel
bennadel / index.cfm
Created April 12, 2023 12:27
Associating Submit Buttons With Any Form Using Button Attributes In Native HTML
<cfscript>
param name="form.name" type="string" default="Tricia";
param name="form.action" type="string" default="";
</cfscript>
<cfoutput>
<!-- BEGIN: Form. -->
<form id="myForm" method="post" action="#cgi.script_name#">