This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
private query function reduceQueryColumns(required query source, required string columns) { | |
var qReduced = ""; | |
query name="qReduced" dbtype="query" { writeOutput("select #arguments.columns# from arguments.source") }; | |
return qReduced; | |
} | |
private query function reRemoveColumns(required query source, required string regex) { | |
var columns = listToArray(arguments.source.columnlist); | |
for (var i = arrayLen(columns); i >= 1 ; i = i - 1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
private struct function mergeStructs(required array structs) { | |
var base = {}; | |
var len = arrayLen(arguments.structs); | |
for (var i = 1; i <= len; i = i + 1) { | |
for (key in arguments.structs[i]) base[lcase(key)]=arguments.structs[i][key]; | |
} | |
return base; | |
} | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
private struct function mergeStructs(required array structs) { | |
var result = {}; | |
var argsLen = arrayLen(arguments.structs); | |
for ( var j = 1; j <= argsLen; j = j + 1 ) { | |
var keys = structKeyArray(arguments.structs[j]); | |
var keysLen = arrayLen(keys); | |
for ( var i = 1; i <= keysLen; i = i + 1 ) { | |
var key = lcase(keys[i]); | |
result[key] = arguments.structs[j][key]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
var parent = $("#container"); | |
var divs = parent.children(); | |
while (divs.length) { | |
parent.append(divs.splice(Math.floor(Math.random() * divs.length), 1)[0]); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- see: http://christianmuellerdesign.wordpress.com/2014/05/23/getting-startet-with-coldfusion-and-mxunit/ ---> | |
<cfcomponent displayname="mxunit.framework.Test" extends="mxunit.framework.TestCase"> | |
<cffunction name="firstTest" access="public" returntype="void"> | |
<cfscript> | |
addTrace("expected vs. actual" ); | |
assertTrue(true); | |
assertEquals(this.expected, true); | |
</cfscript> | |
</cffunction> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Caches Overview</h1> | |
<h2>cacheType</h2> | |
<cfdump var="#cacheCount('cacheType')#" label="cacheType" /> | |
cache cacheType size: <cfoutput>#(SizeOf( cacheGetAll("", "cacheType") )/1024)/1024#</cfoutput> MB<br/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
function foor15Min(t) { | |
var roundedMinutes = INT(minute(t) / 15 ) * 15; | |
return CreateDateTime(year(t), month(t), day(t), hour(t),roundedMinutes,0) | |
} | |
</cfscript> | |
<CFHEADER NAME="Cache-Control" VALUE="public, max-age=900"> | |
<CFHEADER NAME="Last-Modified" VALUE="#LSDateFormat(#foor15Min( DateConvert( 'Local2UTC', now() ) )#, 'ddd, dd mmm yyyy')# #LSTimeFormat(#foor15Min( DateConvert( 'Local2UTC', now() ) )#, 'HH:mm:ss')# GMT"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="normalizeChar" returntype="string" hint="Replaces characters with their non accented closest equivalents" output="true"> | |
<cfargument name="str" type="string" required="true" /> | |
<cfreturn ReplaceList( str,"á,é,í,ó,ú,ý,à,è,ì,ò,ù,â,ê,î,ô,û,ã,ñ,õ,ä,ë,ï,ö,ü,ÿ,À,È,Ì,Ò,Ù,Á,É,Í,Ó,Ú,Ý,Â,Ê,Î,Ô,Û,Ã,Ñ,Õ,Ä,Ë,Ï,Ö,Ü", | |
"a,e,i,o,y,u,a,e,i,o,u,a,e,i,o,u,a,n,o,a,e,i,o,u,y,A,E,I,O,U,A,E,I,O,U,Y,A,E,I,O,U,A,N,O,A,E,I,O,U") /> | |
</cffunction> | |
<cffunction name="normalizeColumn" returntype="query" output="true" hint="normalize single column and add new column [column]_norm"> | |
<cfargument name="qSource" type="query" required="true" /> | |
<cfargument name="column" type="string" required="true" /> | |
<cfset var normColumn = arguments.column & "_norm" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void function structAppend2(required struct base, required string key, required any value) { | |
var paramStruct = {}; | |
paramStruct[arguments.key] = arguments.value; | |
structAppend(arguments.base,paramStruct); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* converts query to sturct map | |
* | |
* @param query source query to convert | |
* @param string key key for the main subkeys, when empty first column taken | |
* @return struct converted map | |
* | |
*/ | |
struct function toMap( required query source, required string key, string ignore="" ) { | |
var map = {}; |