Skip to content

Instantly share code, notes, and snippets.

View neokoenig's full-sized avatar

Tom King neokoenig

View GitHub Profile
@neokoenig
neokoenig / gist:1064616
Created July 5, 2011 10:24
Password Hashing and Salting 3
<!---Get the key--->
<cfset authKeyLocation=expandpath('../auth/key.txt')>
<cffile action="read" file="#authKeyLocation#" variable="authkey">
<!--- New password hashing --->
<!--- Generate a salt, this is never stored in it's plain form--->
<cfset theSalt=createUUID() />
<!--- Hash the password with the salt in it's plain form--->
<cfset passwordHash=Hash(thePassword & theSalt, 'SHA-512') />
<!--- The encrypted salt to store in the database, using the authKey--->
@neokoenig
neokoenig / gist:1064615
Created July 5, 2011 10:23
Password Hashing and Salting 2
<cfset salt=createUUID() />
<cfset passwordHash=Hash(thePassword & salt, 'SHA-512') />
@neokoenig
neokoenig / gist:1064613
Created July 5, 2011 10:23
Password Hashing and Salting 1
<cfset thePassword='myPassword1'>
<cfset passwordHash=Hash(thePassword, 'SHA-512') />
@neokoenig
neokoenig / gist:1031443
Created June 17, 2011 13:48
Starter CSS based on Blueprint CSS for use with CFWheels helpers
/*************************************************
FORMS
Notes: Add this predefined values to your /config/settings.cfm file:
Then, just make sure you add #startFormTag(class="generic")# to any form you want this CSS applied to.
<cfscript>
// Form Field Defaults
set(functionName="textField,textFieldTag,textArea,textAreaTag,passwordField,passwordFieldTag,select,selectTag,fileField,fileFieldTag",
prependToLabel="<div class='field'>",
<cfoutput>
<h2>Photos</h2>
<!--XML last cached #application.FlickrXmlstarted#--->
<cfloop from="1" to="#ArrayLen(photosets)#" index="i">
<cfoutput>
<div id="photoset" class="clear">
<!---Output primary image--->
<img class="left" src="http://farm#photosets[i].XmlAttributes['farm']#.static.flickr.com/#photosets[i].XmlAttributes['server']#/#photosets[i].XmlAttributes['primary']#_#photosets[i].XmlAttributes['secret']#_s.jpg">
<!---output title--->
<cfsilent>
<!---Flickr Params--->
<cfparam name="flickr" default="http://www.flickr.com/services/rest/" />
<cfparam name="key" default="Your API Key Here" />
<cfparam name="userid" default="Your User ID Here">
<!---url.reinit used to manually refresh-->
<cfparam name="url.reinit" default="">
@neokoenig
neokoenig / fib.cfm
Created May 16, 2011 13:45
Fibonacci Loop
<cfset n1 =0>
<cfset n2 =1>
<table>
<thead>
<tr><th>Row</th><th>No.</th><th>Length</th>
</thead>
<tbody>
<cfloop from="1" to="1000" index="i">
<cfset x = (n1 + n2)>
<cfoutput>
<cffunction name="update">
<cfloop from=1 to="#arraylen(contact.emailaddresses)#" index="i">
<cfset contact.emailaddresses[i].delete()>
</cfloop>
<cfset contact.update(params.contact)>
<cfif contact.hasErrors()>
<cfset renderPage(action="edit")>
<cfelse>
<cfset flashInsert(success="The contact was updated successfully.")>
<cfset redirectTo(action="view", key=contact.id)>
<cfoutput>
<cfif params.action EQ "add">
<h2>Add a New Contact</h2>
#startFormTag(class="generic", id="contact-edit", action="create")#
<cfelse>
<h2>Editing Contact</h2>
#startFormTag(class="generic", id="contact-edit", action="update", key=params.key)#
</cfif>
#errorMessagesFor("contact")#
<!--- Dynamic Email Field Template--->
<div id="email-templates" class=" clearfix" style="display: none ;">
<div id="::FIELD1::" class="emailtemplate clearfix">
<div class="span-11">
<div class="field">
<label for="contact-emailaddresses-::FIELD2::-email">Email Address</label>
<input type="text" value="" size="62" name="contact[emailaddresses][::FIELD12::][email]" maxlength="500" id="contact-emailaddresses-::FIELD3::-email" class="email">
</div>
</div>
<div class="span-3">