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.htm
Created August 17, 2022 12:20
Detecting Rendered Line Breaks In A Text Node In JavaScript
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>
Detecting Rendered Line Breaks In A Text Node In JavaScript
</title>
<link rel="stylesheet" type="text/css" href="./main.css" />
</head>
<body>
@bennadel
bennadel / Application.cfc
Created December 30, 2022 15:00
Showing An Error Message In The OnError() Method In Application.cfc In CFML
component
output = false
hint = "I define the application settings and event handlers."
{
// Define the application settings.
this.name = "ResponseTesting";
this.applicationTimeout = createTimeSpan( 1, 0, 0, 0 );
this.sessionManagement = false;
this.setClientCookies = false;
@bennadel
bennadel / app-icon.component.less
Created January 17, 2019 13:42
Creating SVG Icon Components And SVG Icon Sprites In Angular 7.2.0
:host {
color: inherit ;
display: inline-block ;
// Let the app-icon naturally scale with the font-size. Since this is bound to the
// host element, it can easily be overridden by contextual styling.
height: 1em ;
width: 1em ;
}
@bennadel
bennadel / breaker.js
Created July 12, 2017 12:31
Calling Timeout.unref() With setTimeout() Does Not Appear To Be A Best Practice In Node.js
// Require the application modules.
var api = require( "./api" );
// ----------------------------------------------------------------------------------- //
// ----------------------------------------------------------------------------------- //
var TEN_SECONDS = ( 10 * 1000 );
function runWithTimeout( command, timeout = TEN_SECONDS ) {
@bennadel
bennadel / code-1.cfm
Created March 25, 2014 00:34
Sending Text Messages (SMS) With ColdFusion And CFMail
<cfhttp
url="https://www.vtext.com/customer_site/jsp/disclaimer.jsp"
method="POST"
useragent="Mozilla / Firefox"
result="objHTTP">
<!--- Set referrer. --->
<cfhttpparam
type="CGI"
@bennadel
bennadel / test.cfm
Created April 28, 2020 11:35
Creating A Partially-Transparent Overlay Using GraphicsMagick And Lucee CFML 5.2.9.31
<cfscript>
startedAt = getTickCount();
inputFilepath = expandPath( "../images/beach-small.jpg" );
// In the first approach to drawing a partially-transparent image over another, we're
// going to create an intermediary image that represents the image overlay. This will
// the SCALED and PARTIALLY-TRANSPARENT image.
// --
@bennadel
bennadel / schema_auto_increment_columns.sql
Created December 20, 2020 13:53
Looking For Database Performance Bottlenecks And Optimizations Using The Sys Schema In MySQL 5.7
/**
* Find the amount of auto-increment "space" has been used. This may can help identify
* tables that are running out of available ID values.
*/
SELECT
t.table_name,
t.column_name,
-- The highest possible ID that can be created with this data-type.
t.max_value,
-- The last ID created in this table.
@bennadel
bennadel / data.ndjson
Created March 3, 2017 12:49
Parsing And Serializing Large Datasets Using Newline-Delimited JSON In Node.js
{"id":1,"name":"O Brother, Where Art Thou?"}
{"id":2,"name":"Home for the Holidays"}
{"id":3,"name":"The Firm"}
{"id":4,"name":"Broadcast News"}
{"id":5,"name":"Raising Arizona"}
@bennadel
bennadel / code-1.cfm
Created March 25, 2014 00:54
Using ColdFusion To Stream Files To The Client Without Loading The Entire File Into Memory
<!---
Even when using the "smart" buffer, we can still use our
standard ColdFusion header values.
--->
<cfheader
name="content-disposition"
value="attachment; filename='girls.png'"
/>
<!---
@bennadel
bennadel / code-1.htm
Created March 25, 2014 01:06
Ask Ben: Parsing CSV Strings With Javascript Exec() Regular Expression Command
<script type="text/javascript">
// This will parse a delimited string into an array of
// arrays. The default delimiter is the comma, but this
// can be overriden in the second argument.
function CSVToArray( strData, strDelimiter ){
// Check to see if the delimiter is defined. If not,
// then default to comma.
strDelimiter = (strDelimiter || ",");