Skip to content

Instantly share code, notes, and snippets.

View jsieber's full-sized avatar

John Sieber jsieber

  • BlueLine Development
  • Missoula, Montana
View GitHub Profile
@stevewithington
stevewithington / muraImage.cfm
Last active April 28, 2020 15:26
Mura CMS : Meta Image / Primary Associated Image Output
<!---
This is one way to generate a custom meta image based on the content item's primary associated image.
You could use this method in several other ways as well, such as inside a content iterator, etc.
If the fileid passed into this method is not a valid image, then it will return an empty string
--->
<cfif Len($.getURLForImage($.content('fileid')))>
<cfscript>
img = $.getURLForImage(
fileid = $.content('fileid') // could be _any_ fileid in Mura
,size = 'custom' // small, medium, large, custom, or any other pre-defined image size
@justincarroll
justincarroll / bootstrap-masonry-template.htm
Last active August 15, 2020 16:48
This is my template for using Masonry 3 with Bootstrap 3. For those of you who follow this gist a lot has changed since Bootstrap 2.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Masonry Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700">
@stevewithington
stevewithington / dspCustomNavWithChildren.cfm
Last active July 19, 2019 07:28
Mura CMS : display a custom navigation based on a content collection/local index and include children up to a specific depth level.
<cfset feed = $.getBean('feed').loadBy(name='Your Feed Name')>
<cfset it = feed.getIterator()>
<cfif it.hasNext()>
<ul class="nav nav-list">
<li class="nav-header">Your Nav Header</li>
<cfloop condition="it.hasNext()">
<cfset item = it.next()>
<li<cfif $.content('contentid') eq item.getContentID()> class="active current"</cfif>>
<a href="#item.getURL()#">#HTMLEditFormat(item.getMenuTitle())#</a>
<!--- This is where you can specify how deep you want to go --->
@lxcodes
lxcodes / content_iterator.cfm
Last active December 18, 2015 08:59
Mura CMS Basic CFScript Content Iterator from Local Content Index
<cfscript>
// Grab local content index (feed) by name. I believe siteid is optional, but I have always included it.
var feed = application.feedManager.readByName('Banners', $.event("siteid"));
// Create a content iterator from the feed.
var banners = feed.getIterator();
// HTML to add to.
var html = "";
@stevewithington
stevewithington / onSiteCKFinderConfig.cfm
Last active December 17, 2015 03:18
Mura CMS : Programmatically allow CKFinder to accept new file extensions.
<cfscript>
// drop this in your eventHandler.cfc
public void function onSiteCKFinderConfig($) {
var config = arguments.$.event('config');
for (var i=1; i LTE ArrayLen(config.resourceType); i++){
config.resourceType[i].allowedExtensions = ListAppend(config.resourceType[i].allowedExtensions,'abc');
}
arguments.$.event('config',config);
}
</cfscript>
@abhrp
abhrp / showhide.html
Created May 3, 2013 10:38
AngularJS examples for ng-show and ng-hide toggle elements.
<!doctype html>
<head>
<title>AngularJS: ng-show and ng-hide example</title>
</head>
<body ng-app="NgHideShowApp">
<div ng-controller="AppCtrl">
<div>
<input type="checkbox" ng-model="showText">Change Text
<br>
<div ng-show="showText">
@stevewithington
stevewithington / muraImportUsersViaCSV.cfm
Last active January 19, 2024 09:02
Example of how to import Users into Mura CMS via .CSV file. Also see https://gist.github.com/stevewithington/4742829 to import content from an RSS Feed.
<cfscript>
param name='form.csvUrl' default='#getPageContext().getRequest().getScheme()#://#cgi.server_name##getDirectoryFromPath(getPageContext().getRequest().getRequestURI())#users.csv';
param name='form.group' default='Temp';
param name='form.isSubmitted' default='false';
param name='form.isTest' default='true';
param name='form.siteid' default='default';
$ = application.serviceFactory.getBean('$').init(form.siteid);
if ( !$.currentUser().isSuperUser() && !$.currentUser().isInGroup('admin') ) {
@stevewithington
stevewithington / muraImportContentFromRSS.cfm
Last active January 15, 2024 14:29
Mura CMS: Example of how to import content into Mura CMS from an RSS feed. Place the file under your Mura root. For example: http://yourdomain.com/temp/import/index.cfm. Also see https://gist.github.com/stevewithington/5051646 to importUsersViaCSV
<cfscript>
param name='form.rssurl' default='http://www.npr.org/rss/rss.php?id=1014';
param name='form.parentfilename' default='blog';
param name='form.isSubmitted' default='false';
param name='form.istest' default='true';
param name='form.siteid' default='default';
$ = application.serviceFactory.getBean('$').init(form.siteid);
if ( !$.currentUser().isSuperUser() && !$.currentUser().isInGroup('admin') ) {
@stevewithington
stevewithington / muraCategoryIteratorExamples.cfm
Created November 29, 2012 18:13
Mura CMS: Category Iterator Examples
<cfscript>
// Category Iterator of Children of the Current Content Node
itKidsCats = $.content().getKidsCategoryIterator();
// Category Iterator of the CURRENT Content Node
itCats = $.content().getCategoriesIterator();
</cfscript>
<cfoutput>
<!--- Children of the Current Content Node --->
<h4>Kids Categories</h4>
<cfif itKidsCats.hasNext()>
@learncfinaweek
learncfinaweek / gist:4121277
Created November 20, 2012 21:27
ORM - Intro to ORM

Introduction

Object-Relational Mapping (ORM) allows you to work with objects and have them saved to the database automatically. It can greatly simplify create-read-update-delete (CRUD) operations and make your code more object-oriented. Under the hood, ColdFusion uses the industry leading ORM framework called Hibernate.

Configuration