Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Nadel bennadel

View GitHub Profile
@bennadel
bennadel / atos.cfm
Created Aug 10, 2020
Mapping Arrays-To-Structs And Structs-To-Arrays Using Mapping Functions In Lucee CFML 5.3.6.61
View atos.cfm
<cfscript>
friends = [ "Sarah", "Danny", "Todd", "Vera", "Seema" ];
lookup = mapArrayToStruct(
friends,
( mapTo, friend, index ) => {
// The mapTo() function setups the (key, value) pair in the resultant Struct.
mapTo(
@bennadel
bennadel / output.txt
Last active Aug 7, 2020
isNumeric() And numberFormat() Can Work With Very Large Numbers In Lucee CFML 5.3.6.61
View output.txt
true 10
true 100
true 1,000
true 10,000
true 100,000
true 1,000,000
true 10,000,000
true 100,000,000
true 1,000,000,000
true 10,000,000,000
@bennadel
bennadel / test.cfm
Created Aug 6, 2020
Performing An In-Place Natural Sort On An Alpha-Numeric Array In Lucee CFML 5.3.6.61
View test.cfm
<cfscript>
// To demonstrate the two sorting approaches, we're going to embed numbers within the
// following values that will sort differently using an Alphabetical sort (where the
// numbers are compared as Strings) and a Natural sort (where the numbers are
// compared as numbers).
reports = [
"Client 5 Data",
"Client 100 Data",
"Client 20 Data",
@bennadel
bennadel / output.txt
Created Aug 3, 2020
Using A Closure To "Terminate" CFThread Tags Across Page Requests In Lucee CFML 5.3.6.61
View output.txt
[ Test Thread 4b ]: Running iteration 1.
[ Test Thread 4b ]: Running iteration 2.
[ Test Thread 4b ]: Running iteration 3.
[ Test Thread 4b ]: Running iteration 4.
[ Test Thread 4b ]: About to force quit thread.
[ Test Thread 4b ]: CFThread exiting.
@bennadel
bennadel / debug.cfm
Created Aug 2, 2020
RequestTimeout Setting Affects CFThread Execution In Lucee CFML 5.3.6.61
View debug.cfm
<cfscript>
if ( application.keyExists( "testThread" ) ) {
// Dump CFThread data (without the Error, which is output next).
dump(
label = "Test Thread",
var = application.testThread,
hide = "Error"
);
@bennadel
bennadel / Application.cfc
Created Aug 1, 2020
Using A Task CFThread To Run And Restart Daemon CFThreads Indefinitely In Lucee CFML 5.3.6.61
View Application.cfc
component
output = false
hint = "I setup the application settings and event handlers."
{
this.name = "TaskThreadTesting";
this.directory = getDirectoryFromPath( getCurrentTemplatePath() );
this.mappings = {
"/vendor" = "#this.directory#vendor/"
@bennadel
bennadel / data.json
Created Jul 25, 2020
Using Apache POI 3.17 To Save InVision Prototypes As Interactive PowerPoints In Lucee CFML 5.3.6.61
View data.json
[
{
"id": 1,
"name": "Step 1",
"clientFilename": "step-1.png",
"width": 600,
"height": 531,
"hotspots": [
{
"x": 370,
@bennadel
bennadel / index.htm
Created Jul 24, 2020
Using Negative Box-Shadow Spread To Communicate Depth In CSS
View index.htm
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>
Using Negative Box-Shadow Spread To Communicate Depth In CSS
</title>
</head>
<body>
@bennadel
bennadel / snippet.txt
Created Jul 23, 2020
Thinking About Boolean Arguments As A Code-Smell In A Legacy Codebase
View snippet.txt
function directoryCreate(
required string path,
optional boolean createPathIfNotExists = false
) {
// ....
}
@bennadel
bennadel / app.component.ts
Created Jul 21, 2020
Looking At Different Click-To-Edit Implementations In Angular 9.1.12
View app.component.ts
// Import the core angular services.
import { Component } from "@angular/core";
// ----------------------------------------------------------------------------------- //
// ----------------------------------------------------------------------------------- //
export interface Project {
id: string;
name: string;
}
You can’t perform that action at this time.