Skip to content

Instantly share code, notes, and snippets.

View nastanford's full-sized avatar
🏠
Busy Coding

Nathan Stanford Sr nastanford

🏠
Busy Coding
View GitHub Profile
@nastanford
nastanford / dataExample.cfm
Created April 22, 2014 15:58
Simple Ajax Example 002
<cfsetting showdebugoutput="false">
Data Example
<cfdump var="#form#">
@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 / 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 / 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 / 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 / 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 / Coldbox.cfc
Created January 25, 2014 16:13
CFArtGalleryCB - Coldbox.cfc file.
<cfcomponent output="false" hint="My App Configuration">
<cfscript>
/**
structures/arrays to create for configuration
- coldbox (struct)
- settings (struct)
- conventions (struct)
- environments (struct)
- ioc (struct)
@nastanford
nastanford / ColdBox_htmlBaseURL.cfm
Created December 2, 2013 20:13
ColdBox HTML Base URL for style sheets and JavaScript.
<base href="#getSetting('htmlbaseURL')#"/>
<link href="#getSetting('htmlbaseURL')#includes/styles/default.css" rel="stylesheet">
@nastanford
nastanford / getSelectedText.js
Last active June 8, 2020 11:34
Using JavaScript get the Text or Value of a Selected Item in a Select Box.
function getSelectedText(){
var e = document.getElementById("nameSelect");
var dspText = e.options[e.selectedIndex].text;
return dspText;
}
@nastanford
nastanford / queryToArrayOfStructures.cfm
Created August 21, 2013 13:17
Query to array of Structures
<cffunction name="querytoarray" returntype="array" output="No">
<cfargument name="q" required="Yes" type="query">
<cfset var aTmp = arraynew(1)>
<cfif q.recordcount>
<cfloop query="q">
<cfset stTmp = structNew()>
<cfloop list="#lcase(q.columnlist)#" index="col">
<cfset stTmp[col] = q[col][currentRow]>
</cfloop>