Skip to content

Instantly share code, notes, and snippets.

View damiththa's full-sized avatar
🏠
Working from home

Madushan D. Memmendarachchi damiththa

🏠
Working from home
View GitHub Profile
@damiththa
damiththa / README.md
Last active December 11, 2019 18:14
Looping over a list while conditon is met

‎‎Looping over a list

Imagine you have a list where you then need to take a set portion of it as a batch.

Below gits shows how to use a while loop for this to creat batches.

By converting two lists into sets and then comparing them, we can get a list of items that weren't batch first time around. This works for a regular list.

However for a list of json objects, as above, we can't use set. If used as a regular list, it throws below error.

Imagine you have the following dict.

dictIs = { 'key1' : [50, 'qcCheck'], 
           'key2' : [80, 'qcCheck'], 
           'key3' : [20, 'qcCheck'], 
           'key4' : [10, 'qcCheck'], 
           'key5' : [90, 'qcCheck'], 
           'key6' : [30, 'qcCheck'] }
@damiththa
damiththa / FileCSV.cfm
Created January 13, 2016 21:36
Creating a csv file in ColdFusion
<cfset FilePath = "Path\To\The\File">
<cfset FileIs = "FileName.csv">
<cfset FileName = #FilePath#&#FileIs#>
<cffile action="write"
file="#FileName#"
output="Column1,Column2,Column3"
addnewline="yes">
<cfoutput query="qMyQuery">
<cffile action="append"