Skip to content

Instantly share code, notes, and snippets.

@briancribb
briancribb / mura-list-direct-children.cfm
Created August 10, 2016 13:46
Makes an unordered list from the direct children of a content item in Mura. The item is selected by passing in its title attribute.
<!---
Ex: <cfoutput>#listDirectChildren( 'My Title')#</cfoutput>
NOTE: Mura refers to children as "kids" in its internal methods and functions.
--->
<cffunction name="listDirectChildren">
<cfargument name="parentname" required="true" />
<!--- Local variable for use inside this function. --->
<cfset var local = {} />
<cfset local.str = '' />
<cfset local.cBean = $.getBean('content').loadBy(title=arguments.parentname) />
@briancribb
briancribb / mura-if-has-specific-child.cfm
Created August 10, 2016 13:56
Get the children of the current page and see if it has a child with a given name. NOTE: Mura functions and methods refer to children as "kids".
<cfset directChildren = $.content().getKidsQuery()>
<cfquery name="specificChild" dbtype="query">
SELECT * FROM directChildren WHERE title = 'My Specific Title';
</cfquery>
<cfif specificChild.recordCount neq 0>
<!--- The named child is present, so we'll do some stuff. --->
<cfelse>
<!--- Do nothing. --->
</cfif>
@briancribb
briancribb / get-deep-prop.js
Last active November 22, 2017 15:04
Return a deep property of an object
var myObject = {
one: {
two: {
three: 'This is the string you want to see'
}
}
}
function getObjectProps(objTarget, strProp) {
@briancribb
briancribb / jquery-deferred-example
Last active January 24, 2018 16:14
Deferred Example with Multiple Sources
function getData() {
// Fiddle example here: https://jsfiddle.net/briancribb/1j9kdy2q/
// Using an array of data sources, so we can add or subtract them later if we want to.
var that = this,
dfd_array = [],
dfd_sources = {
FIRST : { path:'path/to/data/stuff.json'},
SECOND : { path:'path/to/data/stuff.json'}