Skip to content

Instantly share code, notes, and snippets.

<cfscript>
x = 'This has a tab in it.';
echo(len(x) & '<br>');
echo(len(trim(x)) & '<br>');
</cfscript>
<cfscript>
otel = new Component javasettings='{maven:["com.datadoghq:dd-java-agent:1.49.0", "io.opentelemetry:opentelemetry-api:1.50.0"]}'{
import io.opentelemetry.api.trace.Span;
function span(){
return Span::current();
}
}
otel.span().setAttribute("hello", "world");
<cfscript>
aws = new Component javasettings='{maven:["com.datadoghq:dd-java-agent:1.49.0", "io.opentelemetry:opentelemetry-api:1.50.0"]}'{
import io.opentelemetry.api.trace.Span;
function test(){
return Span::current();
}
}
aws.test().setAttribute("hello", "world");
<cfscript>
aws = new Component javasettings='{maven:["com.datadoghq:dd-java-agent:1.49.0", "io.opentelemetry:opentelemetry-api:1.50.0"]}'{
import io.opentelemetry.api.trace.Span;
function test(){
return Span::current();
}
}
try {
<cfscript>
try {
result = 10 / 0;
}
catch (expression e) {
writeOutput("Error caught: " & e.message);
}
catch (any e) {
writeOutput("Unknown Error: " & e.message);
}
<cfscript>
try {
result = 10 / 0;
}
catch (expression e) {
writeOutput("Error caught: " & e.message);
}
catch (any e) {
writeOutput("Unknown Error: " & e.message);
}
<cfscript>
try {
result = 10 / 0;
}
catch (expression e) {
writeOutput("Error caught: " & e.message);
}
catch (any e) {
writeOutput("Unknown Error: " & e.message);
}
<cfscript>
try {
result = 10 / 0;
}
catch (expression e) {
writeOutput("Error caught: " & e.message);
}
catch (any e) {
writeOutput("Unknown Error: " & e.message);
}
<cfscript>
function showDifference() {
var localVar = "I am var"; // Local only to this function
variables.globalVar = "I am variables"; // Accessible outside the function
}
writedump(showDifference());
</cfscript>
<cfscript>
function showDifference() {
var localVar = "I am var"; // Local only to this function
variables.globalVar = "I am variables"; // Accessible outside the function
}
showDifference();
</cfscript>