Skip to content

Instantly share code, notes, and snippets.

@roryl
roryl / greeting2.cfc
Created April 22, 2016 12:07
Lucee Custom Tag Imports
component {
/**
* Invoked during the start of the custom tag
* @param {struct} required struct attributes The attributes passed to the custom tag
* @param {struct} required struct caller A reference to the variables scope from the location that calls the custom tag
* @return {boolean} To control whether to execute the body of the custom tag
*/
public boolean function onStartTag(required struct attributes, required struct caller){
@roryl
roryl / Application.cfc
Last active August 8, 2016 11:19
Lucee Custom Tag Examples
component {
this.customTagPaths = ["../custom_tag_import"];
}
@roryl
roryl / Application.cfc
Last active June 6, 2016 12:56
Lucee SQL Transactions Examples
component {
this.datasources["employees"] = {
class: 'org.gjt.mm.mysql.Driver'
, connectionString: 'jdbc:mysql://192.168.33.10:3306/employees?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=false'
, username: 'employees'
, password: "123456"
};
this.datasource="employees";
@roryl
roryl / Application.cfc
Last active April 22, 2016 12:50
Lucee Mixin Examples
component {
}
@roryl
roryl / Application.cfc
Last active June 6, 2016 12:54
Lucee Implicit Method Examples
component {
this.triggerDataMember=true;
}
@roryl
roryl / basicComponent.cfc
Last active April 13, 2016 09:44
Lucee Properties Examples
component {
public function init(){
}
}
@roryl
roryl / create_list.cfm
Last active April 11, 2016 12:30
Lucee List Examples
<cfscript>
myList = "one,two,three"; //Create a comma separated list
echo(myList.listLen() & "<br />"); //echo the length, should be 3
myOtherList = "one|two|three"; //Create a pipe separated list
echo(myOtherList.listLen("|") & "<br />"); //Echo the length, should be three. Pass the delimiter because we are overriding the default which was a comma
echo(myList.listLen("t")); //Any character can be a delimiter
</cfscript>
@roryl
roryl / Application.cfc
Last active April 5, 2016 12:32
Lucee Cache Session Storage
component {
this.sessionTimeout = createTimeSpan(0,0,20,0); //Set a default session timeout of 20 minutes
this.sessionStorage = "session"; //Set our session storage to the lucee_sessions datasource
function onSessionStart(){
}
function onRequestStart(){
@roryl
roryl / Application.cfc
Last active April 5, 2016 17:13
Lucee Date Examples
component {
this.timezone = "UTC";
}
@roryl
roryl / Application.cfc
Created April 4, 2016 13:12
Lucee Cache Cluster Read
component {
}