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 / functional_programming.cfm
Created February 23, 2012 16:06
ColdFusion 10 Beta - Closures, Function Expressions, And Functional Programming
<!--- Include our functional programming methods. --->
<cfinclude template="./functional_udfs.cfm" />
<!---
Start a CFScript block. Closures can only be used inside
of CFScript due to the syntax required to define them.
--->
<cfscript>
@bennadel
bennadel / bug1.cfm
Created February 24, 2012 14:01
ColdFusion 10 Beta - Miscellaneous Parsing Bugs And Oddities
<cfscript>
// None of the following three return() statements work when used
// in conjunction with implicit-notations for ARRAY, STRUCT, and
// CLOSURE. Must return "( )" from return statement in order to
// parse properly.
function returnImplictNotation(){
return( [ ] );
@bennadel
bennadel / md5_crypto.cfm
Created February 27, 2012 14:19
ColdFusion 10 Beta - Generating Hash-Based Message Authentication Codes With Hmac()
<cfscript>
// I take an API key and a content value and generate a hashed-
// message authenticate code using MD5 so as to be able to
// authenticate that the message is from a trusted source.
function md5Digest( content, apiKey ){
// We need to hash the content using the MD5 algorithm. Let's
// define a key specification for the HmacMD5 alrorithm using
@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 / tagsoup.cfm
Created February 28, 2012 14:54
ColdFusion 10 - Parsing Dirty HTML Into Valid XML Documents
<!---
Create our "dirty" HTML document. Dirty in the sense that it
cannot be parsed as valid XML. In order to make this document
"bad", we'll have tags that don't self-close and perhaps a
missing close-tag or two.
--->
<cfsavecontent variable="dirtyHtml">
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
@bennadel
bennadel / Application.cfc
Created March 2, 2012 01:18
ColdFusion 10 - Invoking ColdFusion Closures From Within A Java Context
component
output="false"
hint="I define the application settings and event handlers."
{
// Define our standard Application settings.
this.name = hash( getCurrentTemplatePath() );
// I'm setting the Application Timeout to be SUPER LOW since I
@bennadel
bennadel / Application.cfc
Created March 2, 2012 21:03
ColdFusion 10 - Invoking ColdFusion Closures From Within A Java Context, Part II
<cfscript>
// NOTE: Script tags added purely for Gist color-coding only.
component
output="false"
hint="I define the application settings and event handlers."
{
// Define our standard Application settings.
@bennadel
bennadel / Application.cfc
Created March 5, 2012 15:15
ColdFusion 10 - An Augmented Virtual File System (VFS)
<cfscript>
// NOTE: CFScript tags add purely for Gist color-coding. Remove.
component
output="false"
hint="I define the application settings and event handlers."
{
// Define our standard Application settings.
@bennadel
bennadel / Application.cfc
Created March 6, 2012 15:09
ColdFusion 10 - Accessing The Call Stack With CallStackGet()
<cfscript>
// NOTE: The CFScript is purely for Gist color-coding. Remove.
component
output="false"
hint="I define the application settings and event handlers."
{
// Define the application settings.
@bennadel
bennadel / Application.cfc
Created March 9, 2012 23:17
ColdFusion 10 - Creating A ColdFusion WebSocket AMD Module For Use With RequireJS
<cfscript>
// NOTE: The CFScript tag is added purely for Gist color-coding.
component
output="true"
hint="I define the application settings and event handlers."
{
// Define the application settings.