Skip to content

Instantly share code, notes, and snippets.

View cfjedimaster's full-sized avatar
😺
Happy, and tired.

Raymond Camden cfjedimaster

😺
Happy, and tired.
View GitHub Profile
<!--- Raw dynamic data --->
<cfsavecontent variable="content">
<h1>Moo</h1>
<p>
Rock your body...
</p>
<script src="https://gist.github.com/2385560.js?file=gistfile1.txt"></script>
<p>
After gist.
</p>
<!--- generic function to replace gists with raw --->
<cffunction name="replaceGistWithRaw" output="false" returnType="string">
<cfargument name="input" type="string" required="true">
<cfargument name="prefix" type="string" required="false" default="<pre>">
<cfargument name="postfix" type="string" required="false" default="</pre>">
<!--- This is a prefix used for our cache. It ensures all our values share a common prefix and won't conflict with others. --->
<cfset var CACHE_KEY = "gist_">
<cfset var x = "">
<cfset var result = "">
<!--- Raw dynamic data --->
<cfsavecontent variable="content">
<h1>Moo</h1>
<p>
Rock your body...
</p>
<script src="https://gist.github.com/2385560.js?file=gistfile1.txt"></script>
<p>
After gist.
</p>
<script id="result-template" type="text/x-handlebars-template">
<div class="entry">
<h1>{{title}}</h1>
<div class="body">
{{body}}
</div>
</div>
</script>
<!DOCTYPE html>
<html>
<head>
<title>Test 1</title>
<script src="js/handlebars-1.0.0.beta.6.js"></script>
<script id="result-template" type="text/x-handlebars-template">
<h2>Your Bio</h2>
<p>
Your name is {{firstname}} {{lastname}} and you are {{age}} years old.
</p>
<!DOCTYPE html>
<html>
<head>
<title>Test 2</title>
<script src="js/handlebars-1.0.0.beta.6.js"></script>
<script id="result-template" type="text/x-handlebars-template">
<h2>Your Favorite Things</h2>
{{#if things}}
<ul>
<!DOCTYPE html>
<html>
<head>
<title>Test 3</title>
<script src="js/handlebars-1.0.0.beta.6.js"></script>
<script src="js/webtoolkit.md5.js"></script>
<script id="result-template" type="text/x-handlebars-template">
<h2>You and Your Gravatar</h2>
<p>
Your email is {{email}} and your gravatar is:<br/>
<!DOCTYPE html>
<html>
<head>
<title>Comic Character Searcher</title>
<script src="js/handlebars-1.0.0.beta.6.js"></script>
<script id="result-template" type="text/x-handlebars-template">
<h2>Results</h2>
<p>
Your search returned {{number_of_total_results}} result(s).
</p>
<!---
Note - should add some logic to ensure file was properly image - can't trust the client
--->
<cfsetting showdebugoutput="false">
<cffile action="upload" filefield="afile" destination="uploads" nameconflict="makeUnique">
<cfset dataURL = "data:" & "image/" & cffile.clientfileext & ";base64," & toBase64(fileReadBinary(cffile.serverdirectory & "/" & cffile.serverfile))>
<cfset result = {"name":cffile.clientfile, "type":cffile.contenttype,"dataUrl":dataURL,"username":form.username,"accountnum":form.accountnum}>
<cfcontent type="application/json" reset="true"><cfoutput>#serializeJSON(result)#</cfoutput>
if(structKeyExists(url,"init")) {
ormReload();
applicationStop();
location(url="index.cfm",addtoken=false);
}