Skip to content

Instantly share code, notes, and snippets.

<cfscript>
loc.openBoxArr=[];
loc.struct1= {sku:'123',name:'Test1'};
loc.struct2= {sku:'456',name:'Test2'};
arrayAppend(loc.openBoxArr, loc.struct1);
arrayAppend(loc.openBoxArr, loc.struct2);
loc.fileContents = "";
for(line in loc.openBoxArr){
loc.fileContents &= line.sku & "," & line.name & chr(13) & chr(10);
@ryanguill
ryanguill / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ryanguill
ryanguill / testRig.cfm
Last active December 31, 2015 08:19 — forked from adamcameron/testRig.cfm
<cfscript>
testNumbers = [
"0", "0.0", "0.00", "0.000", "0.001",
"0.1", "0.10", "0.100", "0.101",
"0.11", "0.110", "0.111"
];
function formatter(n){
n = int(n * 100) / 100;
<cfcomponent>
<cffunction name="processFizz" access="remote" returntype="String"><!--- no output --->
<cfargument name="input" type="numeric"><!--- no required --->
<cfset var local = structNew()/>
<cfset local.result = ''/>
<cfif arguments.input MOD 3 EQ 0 AND arguments.input MOD 5 EQ 0>
@ryanguill
ryanguill / fizzbuzz.cfm
Created July 19, 2012 13:20 — forked from anonymous/fizzbuzz.cfm
Fizz Buzz
<!--- cf function that solves the fizzbuzz test --->
<!--- I generally don't like functions outputing themselves,
I would rather have it do a return - gives you more flexability later --->
<cffunction name="displayFBMsg" access="private" hint="whatever..."><!--- no returntype / no output --->
<cfargument name="numberOfIterations" required="true" type="numeric"><!--- personal preference, I like name, type, required, but thats not a big deal --->
<cfloop from="1" to="#arguments.numberOfIterations#" index="i"><!--- i is not var'd --->
<!--- with this logic, you're going to do at least 2 checks on every number,
and if those pass, you'll do 4, regardless (just as a comparison) --->
<cfif i MOD 3 EQ 0 OR i MOD 5 EQ 0>
@ryanguill
ryanguill / bitSearch.cfc
Created July 17, 2012 15:08 — forked from linkmckinney/bitSearch.cfc
BitAnd exercise
<cffunction name="valueSearch2" returntype="string" access="remote">
<cfargument name="input" type="numeric" required="true"/>
<cfset var local.msg = ''>
<cfset local.bitAR = arrayNew(1) />
<cfset local.bitAR[1] = { bit = 256, name = 'Authority' } />
<cfset local.bitAR[2] = { bit = 128, name = 'Claims' } />
<cfset local.bitAR[3] = { bit = 64, name = 'Service Failure' } />