Skip to content

Instantly share code, notes, and snippets.

View nastanford's full-sized avatar
🏠
Busy Coding

Nathan Stanford Sr nastanford

🏠
Busy Coding
  • Harrington, Delaware
View GitHub Profile
@nastanford
nastanford / default.cfm
Last active January 4, 2016 13:09
Beginner ColdFusion – ColdBox Art Gallery – Lesson 2
<!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=utf-8" />
<title>ColdFusion Art Gallery</title>
</head>
<body>
<!--- Render The View. This is set wherever you want to render the view in your Layout. --->
<cfoutput>#renderView()#</cfoutput>
</body>
@nastanford
nastanford / ApplicationHelper.cfm
Last active August 29, 2015 13:55
ColdFusion Art Gallery ColdBox Lesson 3
<!--- All methods in this helper will be available in all handlers,plugins,views & layouts --->
<cfscript>
// Alternating Row (classes, bgcolor, or any other alternating row useage)
// example: alternatingRow(TheCurrentRowCount,EvenRowText,OddRowText)
function alternatingRow(currentRow,evenRow,oddRow) {
var returnVar = IIF(currentRow Mod 2, DE(evenrow), DE(oddrow));
return returnVar;
}
</cfscript>
@nastanford
nastanford / cfscriptQuery.cfm
Last active March 21, 2023 21:25
CFScript Query Examples
<CFSCRIPT>
myQry = new Query(datasource="cfartgallery"); // new query object
myQry.setSQL("select bookid, title, genre from app.books where bookid = :bookid"); //set query
myQry.addParam(name="bookid",value="5",CFSQLTYPE="CF_SQL_INT"); // add query param
qryRes = myQry.execute(); // execute query
writedump(qryRes.getResult().recordcount, true); // get resultcount
writedump(qryRes.getResult(), false); // dump result
writeoutput('<BR>');
</CFSCRIPT>
@nastanford
nastanford / model_artist_artist.cfc
Created February 8, 2014 20:36
ColdFusion Art Gallery ColdBox Lesson 4
/**
* @accessors true
* @output "no"
*/
component displayname="Artist" hint="Artist"
{
property name="artistid" type="numeric" displayname="ArtistID" hint="ArtistID";
property name="firstname" type="string" displayname="First Name" hint="First Name";
property name="lastname" type="string" displayname="Last Name" hint="Last Name";
property name="address" type="string" displayname="Address" hint="Address";
@nastanford
nastanford / Application.cfc
Last active September 27, 2019 01:30
Beginner ColdFusion – ColdFusion Art Gallery ORM No Framework Lesson 1
<cfcomponent displayname="CFArtGallery" output="true" hint="Handle the application.">
<!--- Set up the application. --->
<cfset THIS.Name = "CFArtGallery" />
<cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 1, 0 ) />
<cfset THIS.SessionManagement = true />
<cfset THIS.SetClientCookies = false />
<cfset this.datasource = "cfartgallery" />
<cfset this.ormEnabled = true />
<cfset this.ormSettings = { logsql : true } />
<cfset this.invokeImplicitAccessor = true />
@nastanford
nastanford / dataExample.cfm
Created April 22, 2014 15:58
Simple Ajax Example 002
<cfsetting showdebugoutput="false">
Data Example
<cfdump var="#form#">
@nastanford
nastanford / AjaxCFDebug.cfm
Created May 22, 2014 18:08
Add Ajax CFDebug Bookmarklet
u = window.location.href;t1 = u.indexOf("?");q="?";a="&";d="cfdebug=1";if(t1<=0){r=u.concat(q,d)}else{r=u.concat(a,d)};window.location=r;
@nastanford
nastanford / DateDiffBugFixed.cfm
Created October 27, 2014 17:51
ColdFusion DateDiff() Bug Fixed
<cfoutput>
<cfset thedate = '2014-10-30 00:00:00.0'>
Exam Date:
#DateFormat(examdate,'mm/dd/yyyy')#<br />
Today's Date:
#DateFormat(now(),'mm/dd/yyyy')#<br />
DateDiff:
#DateDiff('d',CreateDate(year(now()),month(now()),Day(now())),DateFormat(CreateDate(year(thedate), month(thedate), Day(thedate)),'mm/dd/yyyy'))#
<br />
@nastanford
nastanford / application.cfc
Last active August 29, 2015 14:09
User Defined Functions (functions to remember)
<!--- Example. --->
<cfset this.mappings["/model"]="C:\wwwroot\fv\model">
<cfset structAppend(url,createObject( "component", "model.udf" )) />