Skip to content

Instantly share code, notes, and snippets.

View virtix's full-sized avatar
💭
I may be slow to respond.

bill shelton virtix

💭
I may be slow to respond.
View GitHub Profile
/*
*
* 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;
@virtix
virtix / CFrunt.g.js
Created November 15, 2010 17:51
keeping notes.
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 = []{}
@virtix
virtix / sql_expression.g
Created January 19, 2011 21:23
description here?
grammar E;
options {
backtrack = true;
memoize = true;
output = AST;
ASTLabelType = CommonTree;
}
tokens {
layout title published draft draft_message pub_date
post
An Immutable Object Strategy in ColdFusion
true
false
_DRAFT - Subject to change_
February 1, 2011

{% if page.draft } %(draft){{ page.draft_message }} {%endif%}

@virtix
virtix / Balisong.cfc
Created January 31, 2011 20:36
Balisong.cfc
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){
@virtix
virtix / A-Emailer.java
Created February 23, 2011 14:38
Dependency example
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();