| layout | post |
|---|---|
| title | An Immutable Object Strategy in ColdFusion |
| published | true |
| draft | false |
| draft_message | _DRAFT - Subject to change_ |
| pub_date | February 1, 2011 |
{% if page.draft } %(draft){{ page.draft_message }} {%endif%}
| /* | |
| * | |
| * This is a great muffin recipe, from "Are You Hungry Tonight, Elvis' Favorite Recipes" | |
| * | |
| * */ | |
| (function(){ | |
| var programmer = new Programmer(); | |
| var dry_ingredients = {}; | |
| var wet_ingredient = {}; |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <projectDescription> | |
| <name>adam-c-gists</name> | |
| <comment></comment> | |
| <projects> | |
| </projects> | |
| <buildSpec> | |
| </buildSpec> | |
| <natures> | |
| <nature>org.cfeclipse.cfml.CFENature</nature> |
| <cfcomponent extends="mxunit.framework.TestCase"> | |
| <cfscript> | |
| /** | |
| * Assume cut has two methods: calculate() and getDataFromDatabase(). | |
| * getDataFromDatabase() goes to a Db, which we want to control, and | |
| * calculate() calls getDataFromDatabase(). We want to stub only getDataFromDatabase(). | |
| * | |
| * This "partial" mocking allows one to run tests on a component and mock specific methods | |
| * in that component. | |
| */ |
| <cfscript> | |
| /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| * | |
| * CF9/ColdDoc script for generating static html MXUnit api docs. | |
| * ColdDoc is by Mark Mandel and is included in this MXUnit distribtion. | |
| * | |
| *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | |
| import mxunit.framework.Assert; |
| grammar CFrunt; | |
| options { | |
| backtrack=true; | |
| memoize=true; | |
| } | |
| @header { | |
| package org.foo.bar; | |
| } |
| ; TextPad keyword syntax file for CFML9 | |
| ; Author: virtix | |
| ; Feel free to distribute. | |
| C=1 | |
| [Syntax] | |
| Namespace1 = 6 | |
| IgnoreCase = Yes | |
| KeyWordLength = 0 | |
| BracketChars = []{} |
| grammar E; | |
| options { | |
| backtrack = true; | |
| memoize = true; | |
| output = AST; | |
| ASTLabelType = CommonTree; | |
| } | |
| tokens { |
| layout | post |
|---|---|
| title | An Immutable Object Strategy in ColdFusion |
| published | true |
| draft | false |
| draft_message | _DRAFT - Subject to change_ |
| pub_date | February 1, 2011 |
{% if page.draft } %(draft){{ page.draft_message }} {%endif%}
| cfcomponent { | |
| public any function filter(string predicate, any collection){ | |
| if( isArray(collection) ) return _filterArray(predicate,collection, [] ); | |
| if( isStruct(collection) ) return _filterStruct(predicate,collection, {} ); | |
| return collection; | |
| } | |
| //slightly different implementation for arrays | |
| public any function _filterArray(string predicate, array collection, array accumulator){ |
| package edu.gmu; | |
| import java.util.List; | |
| import org.apache.log4j.*; | |
| public class Emailer { | |
| public void sendEmail(List<Recipient> recipients, String message){ | |
| EmailService service = new EmailService(); | |
| service.connect(); |