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 / 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 / queryToArray.cfm
Last active March 2, 2024 23:25
Convert a ColdFusion/CFML Query to an Array
<cfscript>
public array function queryToArray(query data) {
var local = {};
local.Columns = ListToArray(arguments.Data.ColumnList);
local.QueryArray = ArrayNew(1);
for (local.RowIndex=1; local.RowIndex <= arguments.Data.RecordCount; local.RowIndex++) {
local.Row = {};
for (local.ColumnIndex=1; local.ColumnIndex <= ArrayLen(local.Columns); local.ColumnIndex++) {
local.ColumnName = local.Columns[local.ColumnIndex];
local.Row[local.ColumnName] = arguments.Data[local.ColumnName][local.RowIndex];
@stevewithington
stevewithington / muraGetEventsByCalendarID.cfm
Last active April 25, 2017 00:07
Mura CMS : Get Calendar Events
<cfscript>
public any function getEventsByCalendarID(
calendarid='#variables.$.content('contentid')#'
, start='#CreateDate(Year(Now()), Month(Now()), 1)#'
, end='#CreateDate(Year(arguments.start), Month(arguments.start), DaysInMonth(arguments.start))#'
, returnFormat='query'
, siteid='#variables.$.event('siteid')#'
) {
var tp = variables.$.initTracePoint('getEventsByCalendarID()');
var local = {};
@stevewithington
stevewithington / muraGetCalendarEventsByDate.cfm
Last active October 4, 2017 22:03
Mura CMS : Get Calendar Events by Date
<cfscript>
// Drop this in your THEME or SITE contentRenderer.cfc
public any function getEventsByDate(
calendarContentID='#variables.$.content('contentid')#'
, theDate = '#CreateDate(Year(Now()), Month(Now()), Day(Now()))#'
, returnFormat = 'query'
) {
var local = {};
local.contentBean = variables.$.getBean('content').loadBy(contentid=arguments.calendarContentID);
@stevewithington
stevewithington / 1-getThisMonthEventsByExtendedAttribute.cfm
Last active June 6, 2016 11:48
Mura CMS : Filter Calendar Items by Extended Attribute
<cfscript>
// Drop this in your THEME or SITE contentRenderer.cfc
public any function getThisMonthEventsByExtendedAttribute(
calendarContentID='#variables.$.content('contentid')#'
, extendedAttributeName=''
, extendedAttributeValue=''
, returnFormat='query'
) {
var local = {};
@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;
<?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 / 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
@stevewithington
stevewithington / muraLogoutHandler.cfm
Created May 22, 2014 20:16
Mura CMS : Redirect user after logout
<cfscript>
public any function standardPostLogoutHandler($, event) {
// you could redirect the user to any url you want here
location(url=arguments.$.createHREF(filename='about'), addtoken=false);
}
</cfscript>
@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;