Skip to content

Instantly share code, notes, and snippets.

@roryl
roryl / Application.cfc
Last active November 11, 2021 15:14
Lucee Database Client Storage
component {
this.datasources["lucee_sessions"] = {
class: 'org.gjt.mm.mysql.Driver'
, connectionString: 'jdbc:mysql://192.168.33.10:3306/lucee_sessions?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=true'
, username: 'lucee_sessions'
, password: "encrypted:8c3ea865feab8133a7614f58aee150cddee0ed6f82a476f1"
// optional settings
, storage:true // default: false
@roryl
roryl / Application.cfc
Last active January 16, 2021 19:55
Sample Lucee Application.cfc
component {
// The application name. If you do not set this variable, or set it to the empty string, your CFC applies to the unnamed application scope, which is the Lucee J2EE servlet context. THIS.name = "foo";
this.name = "foo";
/*
this.applicationTimeout = createTimeSpan(0, 1, 0, 0); // Life span, as a real number of days, of the application, including all Application scope variables.
this.clientManagement = false; // Whether the application supports Client scope variables.
this.clientStorage = "registry"; //cookie||registry||datasource // Where Client variables are stored; can be cookie, registry, or the name of a data source. this.customTagPaths = ""; // Contains Lucee custom tag paths. this.datasource = ""; // Name of the data source from which the query retrieves data.
@roryl
roryl / component_a.cfc
Last active February 9, 2020 16:16
First Class Functions - Examples of passing classes around
component {
public function init(){
return this;
}
public function otherFunc(){
echo("called!");
}
@roryl
roryl / component_implicit_path.cfc
Last active July 20, 2018 07:24
Lucee Book examples for creating components
component {
public function init(){
myObj = new components.subComponent();
}
}
@roryl
roryl / Application.cfc
Last active April 28, 2017 08:30
Lucee Database Session Storage
component {
this.datasources["lucee_sessions"] = {
class: 'org.gjt.mm.mysql.Driver'
, connectionString: 'jdbc:mysql://192.168.33.10:3306/lucee_sessions?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=true'
, username: 'lucee_sessions'
, password: "encrypted:8c3ea865feab8133a7614f58aee150cddee0ed6f82a476f1"
// optional settings
, storage:true // default: false
@roryl
roryl / closure.cfm
Last active January 14, 2017 16:31
Lucee 5 Lambda Examples
<cfscript>
myclosure = function(){
return "foo"
}
echo(myClosure());
</cfscript>
@roryl
roryl / server_scope.cfm
Created November 23, 2016 20:38
Lucee Server Scope
<cfscript>
writeDump(server);
</cfscript>
@roryl
roryl / bigInt.cfc
Last active October 27, 2016 13:58
Lucee Numeric Type
component {
public function init(){
}
function checkValue(){
}
@roryl
roryl / Application.cfc
Created October 22, 2016 12:42
Basic Application Settings
component {
this.name = "myapp";
this.timezone = "America/New_York";
}
@roryl
roryl / Application.cfc
Created October 22, 2016 12:35
Application.cfc Name
component {
this.name = "myapp";
}