Skip to content

Instantly share code, notes, and snippets.

View robertz's full-sized avatar

Robert Zehnder robertz

View GitHub Profile
@robertz
robertz / gist:2ec64e9e8e80fe78c31d
Created August 17, 2014 00:17
ColdboxInterceptor.cfc
component {
void function Configure() {}
boolean function afterAspectsLoad(required any event, required struct interceptData){
var Tracker = new whoson.WhosonTracker();
getColdboxOCM().set('WhosOn', Tracker, 0);
return false;
}
@robertz
robertz / gist:51a87ce9e31f87f36fce
Created August 17, 2014 00:44
Interceptors configuration
//Register interceptors as an array, we need order
interceptors = [
//SES
{class="coldbox.system.interceptors.SES",
properties={}
}
//WhosOn
,{class="whoson.ColdBoxInterceptor",
properties={}
}
@robertz
robertz / gist:b62561d896a92fe6800e
Created August 17, 2014 00:53
WhosonTracker.cfc
component name="WhosonTracker" {
function init(){
variables.clients = [];
return this;
}
function trackHit(required Event){
var updateFlag = 0;
var userCount = arrayLen(variables.clients);
@robertz
robertz / gist:4ba6cdc6b4005ada384c
Created August 25, 2014 17:07
RequestContextDecorator example
component extends="coldbox.system.web.context.RequestContextDecorator" {
public void function configure(){
var rc = getRequestContext().getCollection();
var prc = getRequestContext().getCollection(private = true);
if(!structKeyExists(session, 'memberGUID')){
session['memberGUID'] = getController().getSetting('defaultMemberGUID');
}
@robertz
robertz / gist:39a144fee330cd5c491f
Created September 16, 2014 12:36
Fixing da errors
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Simple Chat</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<div id="messageContainer" style="display: none;">
component {
property name = "SQSService" inject = "model";
public function sendMessage(required string message) {
SQSService.sendMessage(queue = "test", message = arguments.message);
return;
}
public function startQueue() {
cfthread(name = "sqs-poll", action = "run", SQSService = SQSService) {
component {
/*
Parts of this are based on Tim Dawe's
http://amazonsig.riaforge.org
and
Joe Danziger's Amazon S3 REST Wrapper
http://amazons3.riaforge.org/
component{
// Configure ColdBox Application
function configure(){
// coldbox directives
coldbox = {
//Application Setup
appName = "Appname",
eventName = "event",
msgDetails = {
to="[email protected]",
from="[email protected]",
subject="example subject",
parts = [
{type="text/plain", body="This is plain text..."},
{type="text/html", body="<strong>bold</strong> text..."}
]
};
@robertz
robertz / timezones.cfm
Created April 20, 2017 16:46 — forked from atuttle/timezones.cfm
Dealing with Time Zones in ColdFusion
<!---
Many thanks to Sean Corfield and Ryan Guill who set me down the correct path of java.util.TimeZone
--->
<cfscript>
writeDump(label="Conversion Examples",var={
"0-local-tz": getSystemTZ()
,"1-local-now": now()
,"2-utc-now": toUTC(now())
,"3-eastern-now": TZtoTZ( getSystemTZ(), now(), "America/New_York" )