This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfsavecontent variable="json"> | |
{ | |
"trueMatch1": { | |
"setting": true | |
}, | |
"falseMatch": { | |
"setting": false | |
}, | |
"trueMatch2": { | |
"setting": true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// directory to create listing for, defaulting to the current one | |
param name="URL.dir" type="string" default=getDirectoryFromPath(getCurrentTemplatePath()); | |
dirCurrent = createObject("java", "java.io.File").init(URL.dir).getCanonicalPath(); | |
dirBase = createObject("java", "java.io.File").init(expandPath("/")).getCanonicalPath(); | |
slash = createObject("java", "java.io.File").separatorChar; // As this displays I'm gonna incur Sean's wrath and use the "correct" slash for the sake of UX | |
// create the domain/port part of the URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// directory to create listing for, defaulting to the current one | |
if (array_key_exists("dir", $_GET)){ | |
$dirCurrent = $_GET["dir"]; | |
}else{ | |
$dirCurrent = getcwd(); | |
} | |
// sort out some baseline dirs / URLs | |
$dirCurrent = realpath($dirCurrent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component { | |
public boolean function matt(path) { | |
var boolReturn = false; | |
var local = {}; | |
local.isInRoot = (listLen( arguments.path, "\/") - listLen(ExpandPath('/'), "\/")); | |
if (local.isInRoot GTE 0) { | |
boolReturn = true; | |
} | |
return boolReturn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component extends="mxunit.framework.TestCase" { | |
public void function beforeTests(){ | |
variables.testFunctions = createObject("functions"); | |
} | |
public void function testCurrentFilePath(){ | |
if (structKeyExists(variables, "testFunction")){ // this variable is defined in extending CFCs. These tests are "abstract" in this CFC | |
test(getCurrentTemplatePath(), variables.testFunction); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component extends="tests" { | |
public void function beforeTests(){ | |
super.beforeTests(); | |
variables.testFunction = variables.testFunctions.adam; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
bugsUrl = "https://bugbase.adobe.com/index.cfm?event=qSearchBugs&page=1&pageSize=500&type=Bugs&product=1149&version=7770&state=OPEN&status=UNVR"; | |
bugUrl = "https://bugbase.adobe.com/index.cfm?event=bug&id="; | |
httpConnection = new Http(URL=bugsUrl, method="get"); | |
bugsJsonP = httpConnection.send().getPrefix().fileContent; | |
bugsJson = removeChars(bugsJsonP, 1, 2); | |
bugs = deserializeJson(bugsJson, false).query; | |
</cfscript> | |
<cfquery name="bugsSorted" dbtype="query"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component extends="mxunit.framework.TestCase" { | |
/** | |
* @hint CFML implementation of Array.reduce(), similar to Javascript's one ref https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce | |
* @array Array to reduce | |
* @callback Callback function to use to reduce. Will receive the following arguments: element (of current iteration of the all), index, array, (optional) result (of preceeding call to callback()) | |
* @initialValue The initial value to use to start the reduction | |
*/ | |
private any function arrayReduce(required array array, required any callback, any initialValue){ | |
var startIdx = 1; | |
if (!structKeyExists(arguments, "initialValue")){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfoutput> | |
<#cf#component output="false"> | |
<#cf#function name="init" returntype="#componentReturnType#" access="public" output="false" hint="Initialises and returns the object"> | |
<#cf#argument name="configFile" type="string" required="true" hint="Config file name"> | |
<#cf#set var jsonConfig = ""> | |
<#cf#file action="read" file="##expandPath('./')####arguments.configFile##" variable="rawConfig"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
q = queryNew(""); | |
queryAddColumn(q, "id", "integer", [1,2,3,4,5,6]); | |
a = makeArray(6); | |
st = makeStruct(6); | |
writeDump(var=q, top="3"); | |
writeDump(var=a, top="3"); | |
writeDump(var=st, top="3"); |