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 / 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 / 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 / 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" )) />
@nastanford
nastanford / CFFunctionAlternatingRow.cfm
Created September 4, 2012 11:52
ColdFusion - Function - Alternating Row Colors
<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 / Windows7SendTo.txt
Created June 12, 2013 16:15
Find the Send To folder to add shortcuts.
Path in Explorer to SendTo:
%APPDATA%\Microsoft\Windows\SendTo
@nastanford
nastanford / OracleOwner_TableAndColumns.cfm
Created June 21, 2013 17:11
Oracle - List Tables and Columns for each table for an Owner
<basefont face="arial" />
<CFSET REQUEST.DSN = "yourdatasource" />
<CFSET REQUEST.OWNER = "owner" />
<CFQUERY NAME="tables" Datasource="#REQUEST.DSN#" >
SELECT table_name
FROM all_tables
WHERE owner = '#REQUEST.OWNER#'
ORDER BY TABLE_NAME
</CFQUERY>
@nastanford
nastanford / loopFormFields.cfm
Last active December 19, 2015 01:49
Loop through form fields
<cfloop index="thefield" list="#form.fieldnames#">
<cfset fields="#thefield# = #form[thefield]#">
<cfset fields="#thefield# = #evaluate(thefield)#">
<cfoutput>#fields#</cfoutput><br>
</cfloop>
Example making the form fields into hidden Form Fields
<!--- ********************************************** --->
<cfloop index="thefield" list="#form.fieldnames#">
<input type="hidden" name="#thefield#" value="#form[thefield]#" />