Skip to content

Instantly share code, notes, and snippets.

# unpacked plugin folders
plugins/**/*
# files directory where uploads go
files
# DBMigrate plugin: generated SQL
db/sql
# AssetBundler plugin: generated bundles
// `controllers/Customers.cfc`
component extends="Controller" {
function init() {
verifies(only="edit,update,show", params="key", paramsTypes="integer");
verifies(only="create,update", params="customer");
}
function new() {
customer = model("customer").new();
component extends="Controller" {
//-----------------------------------------------------
// Public
function init() {
filters(through="authenticate");
}
@chrisdpeters
chrisdpeters / Controller.cfc
Created February 11, 2012 02:43
Automatic Data Handler Functions for Partials in CFWheels 1.1
private struct function articles() {
// Logic goes here
}
@chrisdpeters
chrisdpeters / NewToilets.cfc
Created February 11, 2012 02:51
Add to the Flash with redirectTo() in CFWheels 1.1
<!--- In the controller --->
<cfif toilet.flush()>
<cfset redirectTo(action="lockerRoom", success="Whoooooooosh!")>
</cfif>
@chrisdpeters
chrisdpeters / layout.html
Created February 11, 2012 03:17
New assetQueryString Setting in CFWheels 1.1
<link href="/stylesheets/styles.css?40FDC6D8A9D79E2FF8DB5207A8B03241" media="all" rel="stylesheet" type="text/css" />
@chrisdpeters
chrisdpeters / gist:1812880
Created February 13, 2012 02:42
Sample Asynchronous Google Analytics Script
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
@chrisdpeters
chrisdpeters / gist:1821076
Created February 13, 2012 22:36
Super-Slow ColdFusion Image Processing
<cffunction name="setImageSizes" access="private" hint="Resizes image in queue, moves new resized files to 'production,' and removes `tempUploadId` from DB.">
<cfset var loc = {}>
<cfif isUploadingNewFile()>
<!--- Read image --->
<cflog file="siteScreenshotResize" text="Reading #this.imageFile#">
<cfset loc.image = ImageRead("#variables.UPLOAD_QUEUE_DIRECTORY##this.imageFile#")>
<!--- Turn on antialiasing to improve image quality --->
@chrisdpeters
chrisdpeters / Users.cfc
Created February 13, 2012 22:49
Improving the Tutorial (Again): Including Partials to DRY Up Forms in CFWheels
<cffunction name="add">
<cfset user = model("user").new()>
</cffunction>
<cffunction name="edit">
<cfset user = model("user").findByKey(params.key)>
</cffunction>
@chrisdpeters
chrisdpeters / new.cfm
Created February 13, 2012 22:54
Experimenting with flashMessages() in CFWheels
<cfoutput>
#flashMessages()#
</cfoutput>