Skip to content

Instantly share code, notes, and snippets.

View JonasEriksson's full-sized avatar

Jonas JonasEriksson

View GitHub Profile
@stevewithington
stevewithington / sql-if-else-case.sql
Created November 25, 2015 21:43
SQL: When you need a if / else / then in your WHERE clause, this might help ...
SET @someVar = 'someValue';
SELECT *
FROM t_sometable
WHERE CASE @someVar <> '' THEN someColumn = @someVar ELSE someColumn = '' END;
@stevewithington
stevewithington / muraCustomUI.cfm
Last active December 14, 2023 09:50
Mura CMS: Example of how to use the 'Custom UI' container/tab assignment option when creating a class extension.
<!---
A brief example on how to use the 'CustomUI' option when creating a class extension in Mura CMS.
This example assumes you have an extended attribute called 'Page/Book'.
It also assumes you have an attribute set using the 'CustomUI' container/tab assignment.
Any extended attributes you assign to the attribute set, you are responsible for collecting
that data using your own form fields. Make sure the 'name' and 'id' attributes match the
names you've used when you created the extended attributes! For example, if you have an
extended attribute with a name of 'bookPublisher', make sure you have a form field with an
'id' and 'name' attribute of 'bookPublisher'. Check your casing too!
@stevewithington
stevewithington / dspCarouselByFeedName.cfm
Last active April 28, 2016 17:46
Mura CMS: How to allow for responsive YouTube video embeds in the home page carousel.
<!---
1. Create a "Class Extension" for Link / Video
2. Replace the existing dspCarouselByFeedName() method in the theme's contentRenderer.cfc with the one below
3. Go add some Link/Video content types to your content collection.
For example, copy the YouTube "embed" video src link (Share > Embed) [e.g., https://www.youtube.com/embed/_l09H-3zzgA]
and paste that into the "URL" field when creating a content item.
--->
<cffunction name="dspCarouselByFeedName" output="false">
<cfargument name="feedName" type="string" default="Slideshow" />
@JamoCA
JamoCA / WKHTMLTOPDF.cfm
Last active December 16, 2022 04:30
WKHTMLTOPDF ColdFusion Custom Tag - Converts multiple HTML fragments to PDF.
<CFSETTING ENABLECFOUTPUTONLY="Yes">
<!--- 4/2/2015 by SunStar Media http://www.sunstarmedia.com/ --->
<!--- more posts here: https://gamesover2600.tumblr.com/tagged/wkhtmltopdf --->
<CFPARAM NAME="Attributes.wkhtmltopdfEXEPath" DEFAULT="c:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe">
<CFPARAM NAME="Attributes.ShowDebug" DEFAULT="no"><!--- Yes/No Shows inline results. (default = no) --->
<CFPARAM NAME="Attributes.DebugVar" DEFAULT="WKHMLTOPDF_Result" TYPE="variableName"><!--- Variable name w/PDF generation data. Optional --->
<CFPARAM NAME="Attributes.TimeOut" DEFAULT="60" TYPE="integer"><!--- CFExecute Timeout (Default = 60) --->
<CFPARAM NAME="Attributes.HeaderURL" DEFAULT=""><!--- Publicly accessible URL. Optional --->
<!--- TODO: Add HeaderSpacing --->
@stevewithington
stevewithington / mura-save-external-content.cfm
Last active December 14, 2023 10:19
Mura CMS : How to create content dynamically in Mura. There are two primary pieces to the puzzle: 1) Mura needs to know where to add the content. Specifically, it needs to know the ParentID. 2) Remember, there's only one required field when adding content via the UI, and that's the 'Title' field. To do this dynamically, I usually recommend also …
<cfscript>
// This Gist is very much related directly to https://gist.github.com/stevewithington/4742829 on how to import content via RSS.
// However, this is the main code
content = $.getBean('content').loadBy(remoteid = 'PrimaryKeyFromExternalDB');
content.setTitle('theTitle');
content.setMenuTitle(''); // we clear the other title fields so that Mura will auto-generate them based on the actual 'title'
content.setURLTitle('');
content.setHTMLTitle('');
content.setApproved(1);
content.setIsNav(0);
@jeaguilar
jeaguilar / gist:83a3e784d4b02f390887
Last active March 12, 2019 02:52
Mura Settings.ini.cfm documented and undocumented settings
@stevewithington
stevewithington / muraCategorizedContent.cfm
Last active October 5, 2018 17:56
Mura CMS: How to loop over categories and output any categorized content.
<cfoutput>
<cfset cats = 'Weather,Local News,Arts & Culture' />
<ul>
<cfloop array="#ListToArray(cats)#" index="c">
<li>
<h3>#HTMLEditFormat(c)#</h3>
<cfscript>
catBean = $.getBean('category').loadBy(name=c, siteid=$.event('siteid'));
feed = $.getBean('feed');
@stevewithington
stevewithington / muraAltTheme.cfm
Created August 19, 2014 16:21
Mura CMS : How to dynamically alter which theme Mura will use
<cfscript>
// drop this in your Site eventHandler.cfc
public any function onRenderStart(event, $) {
arguments.$.event('altTheme', 'MyTheme');
}
// this assumes you have a theme directory called 'MyTheme' of course
</cfscript>
@stevewithington
stevewithington / muraSessionVars.cfm
Created August 7, 2014 23:13
Mura CMS : Session Variable Example
<cfscript>
public any function onSiteRequestStart($) {
param name='session.customsession' default=getDefaultCustomSessionSettings();
// you could use whatever trigger you want to set your session var(s), but i'm just using something simple for this example
if ( IsDefined('url.somekey') ) {
lock scope='session' type='exclusive' timeout=10 {
session.customsession = {
somekey = url.somekey
, dateinitalized = Now()
@jsieber
jsieber / masonry.css
Last active August 29, 2015 13:57
Masonry Gallery for MuraCMS
.masonryItem {
width: 8.65%;
margin-bottom: 10px;
float: left;
}
.masonryItem.w2 {
width: 19.5%;
margin-bottom: 10px;
}
#masonryContainer {