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 / clone-regexp.htm
Created July 24, 2014 12:36
Cloning RegExp (Regular Expression) Objects In JavaScript
<!doctype html>
<html>
<head>
<title>Cloning RegExp (Regular Expression) Objects In JavaScript</title>
</head>
<body>
<script type="text/javascript">
/**
@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 || ",");
@bennadel
bennadel / create.sql
Created January 12, 2021 11:47
Generating Newline-Delimited JSON (NDJSON) Using JSON_OBJECT() In MySQL 5.7.32
CREATE TABLE `friend` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`isBFF` tinyint(1) unsigned NOT NULL,
`createdAt` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@bennadel
bennadel / xpath.cfm
Created February 28, 2012 14:00
ColdFusion 10 - XmlSearch() And XmlTransform() Now Support XPath 2.0
<!---
Create an XML document on which to test new XPath 2.0
functionality support.
--->
<cfxml variable="bookData">
<books>
<book id="101" rating="4.5">
<title>Muscle: Confessions of an Unlikely Bodybuilder</title>
<author>Samuel W. Fussell</author>
@bennadel
bennadel / app.component.ts
Created September 7, 2016 12:26
Experimenting With Conditional Enter-Leave Animations In Angular 2 RC 6
// Import the core angular services.
import { animate } from "@angular/core";
import { ChangeDetectorRef } from "@angular/core";
import { Component } from "@angular/core";
import { style } from "@angular/core";
import { transition } from "@angular/core";
import { trigger } from "@angular/core";
interface Friend {
id: number;
@bennadel
bennadel / code-1.cfm
Created March 25, 2014 00:51
Ask Ben: Delete Values In A Given List Using ColdFusion
<cffunction
name="ListDeleteValue"
access="public"
returntype="string"
output="false"
hint="Deletes a given value (or list of values) from a list. This is not case sensitive.">
<!--- Define arguments. --->
<cfargument
name="List"
@bennadel
bennadel / cache.js
Created March 9, 2015 11:56
Creating Objects With A Null Prototype In Node.js
// In this version of the cache, we're going to use an internal object with a null
// prototype and then assume that no user-provided cache keys will ever conflict with
// native keys.
function SafeCache() {
var cache = Object.create( null );
// Reveal the public API.
return({
get: get,
@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>