Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Nadel bennadel

View GitHub Profile
@bennadel
bennadel / ng-query-string.htm
Created Aug 26, 2015
Experimenting With "Query String Zones" In AngularJS
View ng-query-string.htm
<!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 Aug 28, 2015
Accessing The View-Model Inside The Link Function When Using Controller-As In AngularJS
View link-vm.htm
@bennadel
bennadel / Logger.cfc
Created Jan 31, 2014
Spawning Nested ColdFusion Threads With Synchronous Fallbacks
View Logger.cfc
<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 Feb 14, 2014
Using ObjectSave() And ObjectLoad() With Non-ColdFusion-Component Data Types
View object-save.cfm
<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 Feb 21, 2014
Chunking Amazon S3 File Uploads With Plupload And ColdFusion
View index.cfm
<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 Feb 24, 2014
Robust CFScript Suport For Tags In ColdFusion 11 Beta
View attributes.cfm
<!--- 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 Feb 26, 2014
Using The Timeout Attribute With CFHttp In ColdFusion To Limit Blocking
View cfhttp-timeout.cfm
<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 Mar 4, 2014
Sanity Check: $index vs. DOM In AngularJS Directives
View index-vs-dom.htm
<!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 Mar 13, 2014
Embedding Foreign Characters In Your Content-Disposition Filename Header
View high-ascii-filename.cfm
<!---
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 Mar 18, 2014
IsValid() Accepts Emails With Leading And Trailing Whitespace In ColdFusion
View isvalid.cfm
<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 />" );
You can’t perform that action at this time.