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 / ng-query-string.htm
Created August 26, 2015 12:30
Experimenting With "Query String Zones" In AngularJS
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Experimenting With "Query String Zones" In AngularJS
</title>
<link rel="stylesheet" type="text/css" href="./demo.css"></link>
@bennadel
bennadel / link-vm.htm
Created August 28, 2015 11:08
Accessing The View-Model Inside The Link Function When Using Controller-As In AngularJS
@bennadel
bennadel / Logger.cfc
Created January 31, 2014 13:35
Spawning Nested ColdFusion Threads With Synchronous Fallbacks
<cfscript>
component
output = false
hint = "I log message to the given text file."
{
// I initialize the logger to log to the given file.
public any function init( required string aFilePath ) {
filepath = aFilePath;
@bennadel
bennadel / object-save.cfm
Created February 14, 2014 00:27
Using ObjectSave() And ObjectLoad() With Non-ColdFusion-Component Data Types
<cfscript>
// Set up some non-Component data that will be serialized, saved,
// loaded, and then deserialized. Notice that we are including
// "ineresting" data types, including TimeStamps and Queries.
data = {
friends = [
{
name = "Tricia",
age = 47
@bennadel
bennadel / index.cfm
Created February 21, 2014 13:45
Chunking Amazon S3 File Uploads With Plupload And ColdFusion
<cfscript>
// Include the Amazon Web Service (AWS) S3 credentials.
include "aws-credentials.cfm";
// Include some utility methods to make the AWS interactions easier.
include "udf.cfm";
// The expiration must defined in UCT time. Since the Plupload widget may be on the
// screen for a good amount of time, especially if this is a single-page app, we
@bennadel
bennadel / attributes.cfm
Created February 24, 2014 12:36
Robust CFScript Suport For Tags In ColdFusion 11 Beta
<!--- NOTE: ColdFusion 11 was in BETA at the time of this writing. --->
<cfscript>
// Define all of the attributes first. This allows you to
// conditionally build up the attributes to be used.
attributes = {
name: "asyncCode",
action: "run",
thisVar: "Hello",
thatVar: "World"
@bennadel
bennadel / cfhttp-timeout.cfm
Created February 26, 2014 12:54
Using The Timeout Attribute With CFHttp In ColdFusion To Limit Blocking
<cfscript>
// Build the common arguments to be used across both HTTP request.
// I'm doing this just to emphasize that the only thing changing
// in the second request is the timeout-related arguments.
httpArguments = {
method = "get",
url = "http://#cgi.server_name##getDirectoryFromPath( cgi.script_name )#long-task.cfm"
};
@bennadel
bennadel / index-vs-dom.htm
Created March 4, 2014 13:26
Sanity Check: $index vs. DOM In AngularJS Directives
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Sanity Check: $index vs. DOM In AngularJS Directives
</title>
<style type="text/css">
@bennadel
bennadel / high-ascii-filename.cfm
Created March 13, 2014 11:24
Embedding Foreign Characters In Your Content-Disposition Filename Header
<!---
Query for the files in the directory.
--
NOTE: I am doing this so I don't have to embed high-ascii characters
in the code - I don't think my blog has the proper support for UTF-8
encoding? Not sure.
--->
<cfset files = directoryList( expandPath( "./" ), false, "name", "Data*" ) />
<!--- Isolate the file with foreign characters. --->
@bennadel
bennadel / isvalid.cfm
Created March 18, 2014 12:16
IsValid() Accepts Emails With Leading And Trailing Whitespace In ColdFusion
<cfscript>
// Set up test email and whitespace values.
space = chr( 32 );
tab = chr( 9 );
email = "sarah@domain.com";
// Try various combinations of leading / trailing white space.
writeOutput( isValid( "email", "#email#" ) & "<br />" );