Skip to content

Instantly share code, notes, and snippets.

<cfscript>
s = 'eyJuIjoxLCJhIjpbXSwibGF0aW4xIjoiYWJjMTIzIiwiZm9vIjoi4oCgIiwiZSI6IvCfkb4ifQ=="';
writeDump( DeserializeJSON( toString( toBinary( s ) ) ) );
</cfscript>
<cfscript>
route = "/sources?limit=100&offset=100";
path = listFirst( route, "?" );
writeOutput( path );
writeOutput( "<br/>" );
writeOutput( "<br/>" );
query = listRest( route, "?" );
<cftry>
<cfset a = b>
<cfcatch></cfcatch>
</cftry>
<cfscript>
password = "mypassword";
key = "GHIJKLMNOPQR!/$test";
encrypted = encrypt(password, key);
decrypted = decrypt(encrypted, "KLMN");
dump(encrypted);
dump(decrypted);
<cfscript>
password = "mypassword";
key = "GHIJKLMNOPQR!/$test";
encrypted = encrypt(password, key);
decrypted = decrypt(encrypted, "KLMN");
dump(encrypted);
dump(decrypted);
<cfscript>
qry = querynew( "col1", "varchar", [ ["value1"], ["value2"] ] )
</cfscript>
<cfoutput>
<cfloop query="qry">
#col1#
</cfloop>
</cfoutput>
<cfscript>
q = queryNew( [
{ id: 10, label: "Ten" },
{ id: 20, label: "Twenty" }
] )
</cfscript>
<cfoutput>
<cfloop query="q">
#q.label#
<cfscript>
q = queryNew( [
{ id: 10, label: "Ten" },
{ id: 20, label: "Twenty" }
] )
</cfscript>
<cfloop query="q">
#q.currentrow#
</cfloop>
<cfscript>
state = 1;
effDate = '5';
if(state = 1 && isDate(effDate) && dateDiff( "d", now(), effDate ) > 0 )
{
throw(message='not yet effective');
}
else
{
throw('good');
<cfset time="19:50">
<cfif time.find(":")>
<cfset local.hours = time.reMatch("(\d+):(\d+)(?::(\d+))?")>
<cfif arrayLen(local.hours) gt 0>
<cfset local.hours = local.hours[1]>
<cfset local.minutes = local.hours[2]>
<cfset local.seconds = local.hours[3]>
<cfif not isDefined("local.seconds")>
<cfset time = time & ":59">
</cfif>