Skip to content

Instantly share code, notes, and snippets.

View stevewithington's full-sized avatar
⛑️
solving problems

steve withington stevewithington

⛑️
solving problems
View GitHub Profile
@stevewithington
stevewithington / config.js.cfm
Created February 12, 2014 16:32
Mura CMS : example of how to redefine only a portion of the CKEditor toolbar.
// this code goes in the file located under /{SiteID}/includes/themes/{ThemeName}/js/editor/config.js.cfm
config.toolbar_Default[9] = {name: 'group9', items:['Image','Flash','Media','gmap','-','Table','HorizontalRule','SpecialChar','PageBreak','-','Selectlink','SelectComponent','Templates'<cfif application.configBean.getEnableMuraTag()>,'muratag'</cfif>]};
@stevewithington
stevewithington / dspMuraComponent.cfm
Last active August 29, 2015 13:56
Mura CMS : If a Mura 'component' exists, then the object will be returned, otherwise an empty string will be returned.
<cfscript>
// drop this in your Theme or Site contentRenderer.cfc
public any function dspComponent(string componentid, siteid=variables.$.siteConfig('siteid')) {
var bean = IsValid('uuid', arguments.componentid
? variables.$.getBean('content').loadBy(contentid=arguments.componentid, siteid=arguments.siteid)
: variables.$.getBean('content').loadBy(title=arguments.componentid, type='Component', siteid=arguments.siteid);
return !bean.getIsNew()
? variables.$.dspObject(object='component', objectid=bean.getContentID(), siteid=arguments.siteid)
: '';
@stevewithington
stevewithington / config.xml.cfm
Last active August 29, 2015 13:58
Proposed additional nodes to Mura's THEME config.xml.cfm ...
<theme>
<!-- Name of the theme -->
<name></name>
<!-- Version of the theme -->
<version></version>
<!-- Name of the creator/organization that developed the theme -->
<provider></provider>
@stevewithington
stevewithington / muraSlideshowPager.css
Created May 21, 2014 16:05
Mura CMS : jQuery Cycle 2 Slideshow Pager CSS
/* base styling for Mura's jQuery Cycle 2 Slideshow Pagination */
ol.mura-pager {
margin: 0;
padding: 0;
position: relative;
z-index: 2;
}
ol.mura-pager li {
display: inline;
@stevewithington
stevewithington / muraAutoSetReleaseDate.cfm
Created June 3, 2014 10:04
Mura CMS : How to set the Content Release Date automatically, if it's not filled in
<cfscript>
// Drop this function in your Site, Theme, or Plugin's eventHandler.cfc
public any function onBeforeContentSave($) {
// reference to the newBean
var newBean = arguments.$.event('newBean');
// reference to the original contentBean (in case you need it for anything)
var oldBean = arguments.$.event('contentBean');
// Check to see if the contentBean has a parent, and if so
// see if it's the 'News', check the releaseDate and populate if necessary
<?PHP
/*
* PHP upload for Gyazo - v1.2.1 - 3/13/2011
* http://benalman.com/news/2009/10/gyazo-on-your-own-server/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Licensed under the MIT license
* http://benalman.com/about/license/
*/
@stevewithington
stevewithington / onSiteCKFinder.cfm
Created June 11, 2014 22:32
Mura CMS : Override CKFinder's default image compression settings to allow for hi-res images
<cfscript>
// drop this in your eventHandler.cfc
public void function onSiteCKFinderConfig($) {
var config = arguments.$.event('config');
// Override CKFinder's default image compression settings to allow for hi-res images
config.images.maxWidth = 0;
config.images.maxHeight = 0;
config.images.quality = 100;
@stevewithington
stevewithington / getQueryRow.cfm
Created June 27, 2014 18:40
ColdFusion / CFML : get a query containing the desired row data.
<cfscript>
/**
* @param qry The query containing the desired data (required)
* @param row The desired row number (optional)
* @return Returns a query containing the desired row data
*/
public query function getQueryRow(required query qry, numeric row) {
var requestedRow = StructKeyExists(arguments, 'row') ? arguments.row : arguments.qry.currentrow;
var rs = QueryNew(arguments.qry.columnList);
QueryAddRow(rs);
@stevewithington
stevewithington / getWeekOfMonth.cfm
Last active August 29, 2015 14:03
ColdFusion / CFML : Get Week of Month (1-5)
<cfscript>
public any function getWeekOfMonth(date d='#Now()#', numeric minDaysInFirstWeek=1) {
var cal = CreateObject('java', 'java.util.GregorianCalendar').init(
JavaCast('int', Year(arguments.d))
, JavaCast('int', Month(arguments.d)-1)
, JavaCast('int', Day(arguments.d))
, JavaCast('int', Hour(arguments.d))
, JavaCast('int', Minute(arguments.d))
, JavaCast('int', Second(arguments.d))
);
@stevewithington
stevewithington / isoDateTimeFormat.cfm
Created July 1, 2014 17:40
ColdFusion / CFML : Format date/time to ISO 8601
<cfscript>
public any function isoDateTimeFormat(date timestamp='#Now()#') {
var dt = DateConvert('local2utc', arguments.timestamp);
return DateFormat(dt, 'yyyy-mm-dd') & 'T' & TimeFormat(dt, 'HH:mm:ss.000') & 'Z';
}
</cfscript>