Skip to content

Instantly share code, notes, and snippets.

@jbuda
jbuda / gist:5117070
Created March 8, 2013 15:10
Sencha controller for handling a container part of a navigation stack that shows hides tab bar
Ext.define 'TestApp.controller.Item'
extend: 'Ext.app.Controller'
config:
refs:
newsPanel:'newspanel'
newsItem:'newsitem'
mainPanel:'maintoolbar'
control:
newsPanel:
@jbuda
jbuda / gist:5195715
Created March 19, 2013 12:32
Converts XML Attributes to Object
package xml.utils {
public class XMLUtils {
public static function attributesToObject($xml:XMLList):Object {
var atts = new Object();
for (var i:int=0; i<$xml.length(); i++) {
atts[$xml[i].name().toString()] = $xml[i];
}
return atts;
}
}
@jbuda
jbuda / gist:5195731
Last active December 15, 2015 03:39
CFThread
<cfthread name="Importing_dataset">
<!--- DATA PROCESSING --->
</cfthread>
@jbuda
jbuda / gist:5195742
Created March 19, 2013 12:37
Output of a CFThread with Java
<cfset thr = CreateObject('java', 'java.lang.management.ManagementFactory').getThreadMXBean() >
<cfset in = CreateObject('java', 'java.lang.Integer')>
<cfset thrArray = thr.getThreadInfo(thr.getAllThreadIds(),in.MAX_VALUE)>
<cfloop array="#thrArray#" index="thread">
<cfset st = thread.getStackTrace()>
<cfloop array="#st#" index="stack">
<cfdump var="#thread.getThreadId()# #stack.getClassName()# - #stack.getMethodName()# - #stack.getFileName()#" /><br/>
</cfloop>
</cfloop>
@jbuda
jbuda / gist:5195756
Created March 19, 2013 12:38
CF ORM EntityLoad
entityLoad('qp', {vendor like '%critera%',description like '%criteria%'}, true)
@jbuda
jbuda / gist:5195764
Created March 19, 2013 12:40
CF ORM Named parameters
public array function search(string crit) {
var qry = "from vendors and (description like '#arguments.crit#' or vendor like '#arguments.crit#')";
var r = ORMExecuteQuery(qry);
return r;
}
@jbuda
jbuda / gist:5195768
Created March 19, 2013 12:41
CF ORM with like parameters
public array function search(string crit) {
var qry = "from vendors and (description like :criteria or vendor like :criteria)";
var r = ORMExecuteQuery(qry,{criteria="%"&arguments.crit&"%"});
return r;
}
@jbuda
jbuda / gist:5195801
Created March 19, 2013 12:45
HTML simple form
<form name="testForm" action="" method="post">
<label>Favourite language: </label><input type="text" name="technology" id="technology" />
</form>
@jbuda
jbuda / gist:5195810
Created March 19, 2013 12:47
Pre-populating MuraCMS form field within the ContentRenderer.cfc
<cffunction name="dspObjects" access="public" output="false" returntype="string">
<cfargument name="columnID" required="yes" type="numeric" default="1">
<cfargument name="ContentHistID" required="yes" type="string" default="#event.getValue('contentBean').getcontenthistid()#">
<cfset var rsObjects="">
<!--- get the string from super --->
<cfset var theRegion=trim(super.dspObjects(arguments.columnID,arguments.ContentHistID)) />
<!--- using the returned string look for any form to pre-polulate --->
<cfset bodystr = theRegion />
<cfset bodystrRes = refindnocase(">form.*?(name)*<",bodystr,1,true) />
@jbuda
jbuda / gist:5195839
Created March 19, 2013 12:50
CF file download via FTP
<cfsetting requestTimeOut="100000" />
<cfoutput query="pdfsToDownload">
<cfftp action="getFile"
server="__server__"
username="__username__"
password="__password__"
localfile="#expandPath('\temp\')##listLast(file,'/')#"
remoteFile="__remotefile__" />
</cfoutput>