Skip to content

Instantly share code, notes, and snippets.

@roryl
roryl / javahttp.cfm
Created September 27, 2013 13:58
Make a request in Java instead of CFHTTP to resolve SNI issues
<cfscript>
myUrl = "https://news.google.com/news?gl=us&hl=en&as_epq=chinese+medicine&as_occt=title&as_qdr=a&authuser=0&q=allintitle:++%22chinese+medicine%22&um=1&output=rss"; // web service url
objUrl = createobject("java","java.net.URL").init(myUrl);
conn = objUrl.openConnection();
//configure the request
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestMethod("GET");
@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 / 0_reuse_code.js
Created March 9, 2016 17:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@roryl
roryl / ssl_test.cfm
Created March 10, 2016 22:58
Tests what Lucee is making for an SSL request
<cfhttp url="https://www.howsmyssl.com/" />
<cfdump var=#rematch('Your client is using[^<]+',cfhttp.FileContent)# />
<cfdump var=#Server.Lucee.Version# />
<cfdump var=#Server.Java.Version# />
<cfoutput>#cfhttp.filecontent#</cfoutput>
@roryl
roryl / about_us.cfm
Last active March 11, 2016 10:46
Lucee Template Examples
<h1>About Us</h1>
<cfinclude template="navigation.cfm" />
<p>
Page content about us
</p>
@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 / 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 / Application.cfc
Last active June 6, 2016 12:55
Local Scopes - Examples showing local scopes in functions
component {
}
<cfscript>
myVar = "test";
myStruct = {test:"foo"; test2:"bar"}
echo(myStruct[myVar]); //outputs "foo"
echo(myStruct["#test2#"]; //outputs "bar"
</cfscript>
@roryl
roryl / vagrantfile.rb
Created March 13, 2016 01:54
A sample vagrant file for building a CentOS 6.5 VM With Lucee, Apache and MySQL
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at