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 / index.cfm
Created April 10, 2023 12:25
Listen For Stimulus Custom Events Outside Of Hotwire
<cfscript>
emojis = [
{
name: "Grinning Face",
hex: "1F600"
},
{
name: "Heart",
hex: "2764 FE0F"
@bennadel
bennadel / analytics.cfm
Created April 9, 2023 13:07
Using navigator.sendBeacon() To Publish Analytics Back To ColdFusion
<cfscript>
param name="url.test" type="string";
requestData = getHttpRequestData();
// We're going to echo-back the type of beacon data that we received.
response = [
contentType: requestData.headers[ "Content-Type" ],
method: cgi.request_method,
@bennadel
bennadel / index.htm
Created April 8, 2023 10:48
Using Public Class Fields To Bind Event Handlers In JavaScript
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" href="./main.css" />
</head>
<body>
<h1>
@bennadel
bennadel / index.htm
Created April 7, 2023 11:42
Using A Transient CSS Stylesheet To Remove Scrolling On Body While Modal Is Open
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="./main.css" />
</head>
<body>
<h1>
Using A Transient CSS Stylesheet To Remove Scrolling On Body While Modal Is Open
@bennadel
bennadel / index.htm
Created April 6, 2023 12:24
Removing A CSS Stylesheet Removes Its Affect On The Document
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="./main.css" />
</head>
<body>
<h1>
Removing A CSS Stylesheet Removes Its Affect On The Document
@bennadel
bennadel / index.htm
Created April 6, 2023 10:56
CSS overscroll-behavior Only Affects Scroll Containers
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="./main.css" />
<style type="text/css">
.modal {
display: flex ;
flex-direction: column ;
@bennadel
bennadel / GameOfLife.cfc
Created April 2, 2023 14:19
Conway's Game Of Life In Hotwire And ColdFusion
component
output = false
hint = "I provide game play methods for Conway's Game of Life."
{
/**
* I initialize the Game of Life with the given cell keys. Each key is a composite of
* the "x,y" coordinate of a living cell within the infinite canvas of biodiversity.
*/
public void function init(
@bennadel
bennadel / test.cfm
Created March 29, 2023 12:26
Getting FusionReactor User Experience Monitoring (UEM) To Play Nicely With Content Security Policy (CSP) In ColdFusion
<cfscript>
frapi = createObject( "java", "com.intergral.fusionreactor.api.FRAPI" )
.getInstance()
;
csp = application.contentSecurityPolicy.getCspConfig();
// Set the strict Content-Security-Policy.
cfheader( attributeCollection = csp.header );
@bennadel
bennadel / snippet-1.js
Created March 24, 2023 12:34
Trying To Get ChatGPT 4 To Solve My Hotwire Form Submission Problem
document.addEventListener("DOMContentLoaded", function() {
// Get the form element
const form = document.querySelector("form");
// Listen for the Turbo Drive form submission event
form.addEventListener("turbo:submit-end", function() {
// Scroll the form back into view
form.scrollIntoView();
});
});
@bennadel
bennadel / about.cfm
Created March 23, 2023 12:55
Disabling Turbo Drive In A Subdirectory Of Your ColdFusion Application
<cfmodule template="./tags/page.cfm" section="about">
<cfoutput>
<h2>
About This Site
</h2>
<p>
Copy copy copy....
</p>