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 / callback_with_return.htm
Created February 1, 2012 15:19
Use A Return Statement When Invoking Callbacks, Especially In A Guard Statement
<!DOCTYPE html>
<html>
<head>
<title>Using Return Statements When Invoking Callbacks</title>
<script type="text/javascript">
// Define a success handler.
var successHandler = function(){
@bennadel
bennadel / api.cfm
Created February 3, 2012 15:29
ColdFusion Supports HTTP Verbs PUT And DELETE (As Well As GET And POST)
<!---
Create a buffer for our output of the way various Scopes are
presented during different HTTP requests.
--->
<cfsavecontent variable="debugOutput">
<cfdump
var="#cgi#"
label="CGI Scope"
show="content_type, request_method"
@bennadel
bennadel / demo.htm
Created February 6, 2012 15:29
jQuery.whenSync() Plugin For Chaining Asynchronous Callbacks Using Deferred Objects
<!DOCTYPE html>
<html>
<head>
<title>jQuery.whenSync() For Asynchronous, Deferred Chaining</title>
<!-- Include jQuery and the whenSync() plugin. -->
<script type="text/javascript" src="../jquery-1.7.1.js"></script>
<script type="text/javascript" src="./jquery.whensync.js"></script>
<script type="text/javascript">
@bennadel
bennadel / demo.htm
Created February 10, 2012 16:16
Cross-Origin Resource Sharing (CORS) AJAX Requests Between jQuery And Node.js
<!DOCTYPE html>
<html>
<head>
<title>Cross-Origin Resource Sharing (CORS) With jQuery And Node.js</title>
</head>
<body>
<h1>
Cross-Origin Resource Sharing (CORS) With jQuery And Node.js
</h1>
@bennadel
bennadel / demo.htm
Created February 13, 2012 16:01
Using jQuery.whenSync() For Asynchronous Form Validation And Processing
<!DOCTYPE html>
<html>
<head>
<title>Using jQuery $.whenSync() For Asynchronous Form Processing</title>
<!-- Include jQuery and the whenSync() plugin. -->
<script type="text/javascript" src="../jquery-1.7.1.js"></script>
<script type="text/javascript" src="./jquery.whensync.js"></script>
<script type="text/javascript">
@bennadel
bennadel / love.js
Created February 14, 2012 16:00
Building Executable Scripts For The Mac OSX Command Line With Node.js
#! /usr/local/bin/node
// ^-- Tell the terminal which interpreter to use for the execution
// ^-- of this script. For our purposes, we'll be using the Node.js
// ^-- interpretor (which was installed in the local BIN directory
// ^-- using HomeBrew.
// ---------------------------------------------------------- //
// ---------------------------------------------------------- //
@bennadel
bennadel / test1.cfm
Created February 20, 2012 14:52
ColdFusion 10 Beta - Closures And Function Expressions - Part I
<!---
Start a CFScript block. Closures can only be used inside
of CFScript due to the syntax required to define them.
--->
<cfscript>
// I map one array onto a new array, invoking the callback
// on each target array item. If NULL is returned, no item
// is added to the new array; if an array is returned, all
@bennadel
bennadel / closure_bug.cfm
Created February 20, 2012 15:44
ColdFusion 10 Beta - Critical Bug In Compiling Function Expressions / Closures
<!---
Start a CFScript block. Closures can only be used inside
of CFScript due to the syntax required to define them.
--->
<cfscript>
// I return any arguments that I received.
function echoArguments(){
@bennadel
bennadel / thread1.cfm
Created February 21, 2012 15:13
ColdFusion 10 Beta - Closures And Function Expressions And Threads
<!---
Start a CFScript block. Closures can only be used inside
of CFScript due to the syntax required to define them.
--->
<cfscript>
// I am a factory for the thread callbacks.
function getThreadCallback(){
@bennadel
bennadel / component1.cfm
Created February 22, 2012 14:34
ColdFusion 10 Beta - Closures And Components And The THIS Scope
<!---
Start a CFScript block. Closures can only be used inside
of CFScript due to the syntax required to define them.
--->
<cfscript>
// Create an instance of our new component and access the
// closure "Tunnel" that we've tried to create.
getter = new Simple().getClosure();