Skip to content

Instantly share code, notes, and snippets.

<Cffunction returnType="string" name="x">
<cfreturn '<?xml version="1.0" encoding="utf-8"?><myXml></myXml>' />
</Cffunction>
<cfscript>
foo = ( xml xmlData ) => dump( xmlParse( x() ) );
dump( x() )
</cfscript>
<cfscript>
writeDump( TimeFormat(Now(),'HH-mm') );
</cfscript>
<cfset s = "62397EAD17D5BEFBD0C93C8A">
<cfscript>
function greet(name) {
return "hello, " & name & "!";
}
result = greet("Alice");
writeOutput(result);
</cfscript>
<cfset pw ="">
<cfset Acode = decrypt(pw, 'MiCamino44', "CFMX_COMPAT", "hex")>
<cfdump var ="#acode#">
<cfset animal = createobject("component", "Animal")>
<cfsavecontent variable="jsonstr">{"animal":{"id":1,"name":"chicken","eats":"chicken food","says":"cluck cluck"}}</cfsavecontent>
<cfset decoded = deserializejson(jsonstr).animal>
<cfset animal.setId(decoded.id).setName(decoded.name).setEats(decoded.eats).setSays(decoded.says)>
<cfscript>
// Lucee
typedArray = arrayNew(dimension: 1, synchronized : true, type:"Animal");
//ACF v1 - syntax listed would throw error in Lucee, but creates an array type Animals
//typedArray = arrayNew(dimension: 1, issynchronized : true, typename:"Animal");
//ACF v2 - this is the alleged way, but it does not create an array type Animals
<cfscript>
miArray = ArrayNew(1, "numeric");
ArrayAppend(miArray, "Hola");
</cfscript>
<cfsetting requestTimeout="10">
<cfscript>
try {
result = countOccurences("hello", "");
writedump(result);
} catch(e) {
writedump(e);
}
</cfscript>
<cfscript>
arr = [1,2,3];
val = arr.pop();
writedump({
"arr" : arr,
"val" : val
});