Skip to content

Instantly share code, notes, and snippets.

@kukielp
kukielp / console.cfm
Created January 5, 2021 02:19
Custom tag
<cfif thisTag.executionMode == "start">
<script>
console.log('Message to the browser console. My variable: <cfoutput>#attributes.variable#</cfoutput>');
</script>
</cfif>
@kukielp
kukielp / index.cfm
Created January 5, 2021 02:18
Customtage CFML
Calling a custom tag.
<cfset someVariable = "First Name + Last Name" />
<cf_console variable="#someVariable#" />
<cfscript>
loopLength = 10
qry = queryNew("id,dstart_time", "integer,Timestamp");
for(i=1; i<loopLength; i++){
tmpDate = dateAdd("d",-i,now());
queryAddRow(qry);
querySetCell(qry, "id", i);
querySetCell(qry, "dstart_time", tmpDate);
}
@kukielp
kukielp / cf.sh
Last active November 17, 2020 21:23
sudo yum install -y https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.rpm
wget https://services.gradle.org/distributions/gradle-6.5-bin.zip -P /tmp
sudo unzip -d /opt/gradle /tmp/gradle-6.5-bin.zip
# Set 2 EVN variables to add gradel to the path
export GRADLE_HOME=/opt/gradle/gradle-6.5
export PATH=${GRADLE_HOME}/bin:${PATH}
# Ensure the ENV variables persist in a new terminal session
.PHONY: build clean deploy
build:
./cfusion/bin/lambdazip.sh
clean:
rm ./cfusion/bin/dist/cf-aws-serverless.zip
deploy: clean build
sam deploy
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Timeout: 900
Resources:
AWSServerless:
Type: AWS::Serverless::Function
<cfquery name="q" result="r">
select *
from customer
</cfquery>
<cfdump var="#q#"/>
<cfdump var="#r.EXECUTIONTIME#"/>
<cfquery name="q" result="r">
select *
from customer
</cfquery>
<cfdump var="#q#"/>
<cfdump var="#r.EXECUTIONTIME#"/>
component {
this.name="cfmlServerless";
this.applicationTimeout = CreateTimeSpan(10, 0, 0, 0); //10 days
this.sessionManagement=false;
this.clientManagement=false;
this.setClientCookies=false;
// Yes yes, shoudl not embed in code but for PoC it's fine.
this.datasources = {