Skip to content

Instantly share code, notes, and snippets.

Adam Tuttle atuttle

View GitHub Profile
atuttle / timezones.cfm
Last active Dec 9, 2019
Dealing with Time Zones in ColdFusion
View timezones.cfm
Many thanks to Sean Corfield and Ryan Guill who set me down the correct path of java.util.TimeZone
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" )
View .gitconfig
name = Adam Tuttle
email =
ui = auto
autocrlf = input
excludesfile = /Users/adam/.gitignore_global
default = tracking
atuttle / adminBase.cfc
Last active Aug 29, 2015
Securing FW/1 applications; segmented by controller
View adminBase.cfc
component accessors="true" {
property framework;
property memberService;
function before( rc ){
local.safeEvents = 'main:member.login,main:member.forgot,main:member.resetpassword';
//require login for everything in this controller except login method
if (!structKeyExists(session, 'user')){
atuttle / Application.cfc
Created Nov 4, 2014
How I like to do configuration with DI/1
View Application.cfc
component {
function getEnvironment(){
if (cgi.server_name contains ".local" or cgi.server_name contains ".dev"){
return "dev";
if (cgi.server_name contains "qa."){
return "qa";
return "prod";
atuttle / example.cfm
Last active Aug 29, 2015
Generating random numbers with a trend to make data appear more realistic in some scenarios. 50% chance for a direction change.
View example.cfm
//to initialize to a random number instead of 50, set last to ""
last = 50;
for(var i = 1; i <= 100; i++){
last = trendingRandom( 0, 100, 12, last );
writeOutput( "#last#<br/>" );
atuttle / package.json
Created Oct 2, 2014
Using a free RedisToGo Nano instance on heroku, or the default settings on your local environment
View package.json
"dependencies": {
"redis": "^0.10.1"

Here's a simple repro case. Since this test involves ORM, you'll have to create a DSN. I'm testing against MySQL but it should be DB agnostic (that's part of the draw of ORM, right?)...

Just create a database and a new DSN named "repro" (or update the code accordingly), put foo.cfc into a folder named "orm", and everything else should work as expected.

atuttle / Default (OSX).sublime-keymap
Created Aug 8, 2014
My Sublime Text 3 Preferences and Keymaps
View Default (OSX).sublime-keymap
{ "keys": ["alt+up"], "command": "swap_line_up" }
,{ "keys": ["alt+down"], "command": "swap_line_down" }
,{ "keys": ["ctrl+alt+down"], "command": "duplicate_line" }
,{ "keys": ["alt+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }
"keys": ["ctrl+alt+left"],
"command": "set_layout",
"args": {
atuttle / ACF_custom_errors_partial_match.cfm
Last active Aug 29, 2015
This file demonstrates that ACF (Tested on latest patched CF10) does allow for "partial matching" of custom-typed thrown exceptions.
View ACF_custom_errors_partial_match.cfm
try {
} catch(com.myService.FooException e){
writeOutput("caught it @ com.myService.FooException");
atuttle /
Last active Aug 29, 2015
Relevant links for my Philly Tech Week 2014 talk: Integrate ALL the Things!
You can’t perform that action at this time.