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 / mobile.cfm
Created January 5, 2018 20:40
Mura Platform: Example Mobile Layout Template Using jQuery Mobile
<cfsilent>
<!---
NOTE: Since the MuraBootstrap theme is a 'Responsive' framework, this layout is
completely optional. It uses jQuery Mobile (http://jquerymobile.com/) to display
content for handheld devices.
To use it, simply rename the file to 'mobile.cfm'
If you wish to see how it looks, simply append '/?mobileformat=1' to the end of the
URL. You could also add a link to your full site footer to allow people to view your
@stevewithington
stevewithington / cfml-cfhttp-docker.md
Last active December 14, 2017 15:39
ColdFusion (CFML) Localhost CFHTTP Call Inside of Docker on MacOSX

There's an issue when attempting to perform a cfhttp call inside of Docker to localhost on MacOSX. For some reason, this issue does not appear to exist on Windows. Instead of hitting localhost, you must use the "Service Name" as defined in your docker-compose.yml file, and the container's exposed port (NOT the one you're using outside of the container).

Example docker-compose.yml

version: '3.3'
  services:
    myservice:
@stevewithington
stevewithington / muraFormBuilderRemoteSource.cfc
Last active November 20, 2020 15:19
Mura: Example of how to populate a Mura Form Builder option list using `Remote Source`
component {
/**
* MURA FORM: `REMOTE SOURCE` Options Example
*
* Notes:
* + On the form, select `Remote Source` and enter the full URL to where this file resides, along with `?method=getData`
* - For example <http://localhost:8080/sites/{SiteID}/remote/muraFormBuilderRemoteSource.cfc?method=getData>
* + If storing this file under the `/sites` directory, be sure to place it under a directory named `remote` to avoid Access Denied issues
* + If running inside of a Docker container, you MUST use the internal network PORT (e.g., `8080` vs. `80`)
* + How to use a CUSTOM OBJECT for options: <https://gist.github.com/stevewithington/7947902>
@stevewithington
stevewithington / mura-dspDescendants.cfm
Created December 7, 2017 16:19
Mura CMS: How to create custom navigation with permissions applied, based on a contentID and its children.
<!---
Place this function in your Site or Theme contentRenderer.cfc
Invoke by calling `$.dspDescendants()`
--->
<cffunction name="dspDescendants">
<cfargument name="contentid" type="string" default="#$.content('contentid')#" />
<cfset var local = {} />
<cfset local.cBean = $.getBean('content').loadBy(contentid=arguments.contentid) />
<cfsavecontent variable="local.str">
@stevewithington
stevewithington / mura-ckeditor-image-options.js
Created November 20, 2017 19:01
Mura CMS: CKEditor has 2 image plugins, and you can easily use either of them on a theme-by-theme basis.
/*
There are two (2) image plugins available for CKEditor:
The "Image" plugin (https://ckeditor.com/cke4/addon/image), which is used by default;
and the "Enhanced Image" plugin (https://ckeditor.com/cke4/addon/image2), which offers the ability to caption images.
To enable the "Enhanced Image" plugin, follow these instructions:
1. Edit the file located under {ThemeName}/js/editor/config.js.cfm
(if the file doesn't exist, create it ... if the config.js.cfm.txt file exists, rename it to remove '.txt')
@stevewithington
stevewithington / mura-html-editor-word-character-count.js
Last active April 27, 2018 19:08
Mura CMS: How to add word count and character count to HTML Editors
/*
There's an elegant way to restrict character or word count in Mura CMS HTMLEditors.
1. Download the Word Count & Char Count Plugin:
https://ckeditor.com/cke4/addon/wordcount
2. Download the Notification plugin:
https://ckeditor.com/cke4/addon/notification
3. Unzip the the plugins and add the directories to the CKEditor plugins directory:
@stevewithington
stevewithington / mura-admin-scripts.cfm
Last active April 27, 2018 19:07
Mura CMS: How to add custom scripts (JavaScript, etc.) to the administrative area
<cfscript>
// this example shows how to add custom scripts in the Admin area ...
// you could also use jQuery or whatever other method as well.
// Add this method to a Mura CMS SITE, THEME or PLUGIN eventHandler.cfc
public any function onAdminHTMLFootRender(m) {
var str = '';
savecontent variable='str' {
WriteOutput('
<script>
// Your script goes here.
@stevewithington
stevewithington / git-clone-single-branch.sh
Created November 13, 2017 22:55
Git: Clone single branch
git clone -b <branchname> --single-branch https://github.com/<user>/<repo> <dir>
@stevewithington
stevewithington / TweetPresenter.js
Created November 2, 2017 14:18 — forked from jevakallio/TweetPresenter.js
Tweet Presenter!
// paste this to chrome console on anybody's twitter page
// and it'll turn into an instant presentation :)
(function TweetPresent() {
const presenter = $(`<div id="tpd" style=" position: fixed; top: 0; left: 0; height: 100vh; width: 100vw; padding: 10vh 10vw; box-sizing: border-box; background-color: white; font-size: 5vw; text-align: center; z-index: 9999; display: flex; align-items: center; justify-content: center;"></div>`);
const tweets = $$(`div.tweet p.js-tweet-text`)
.map(el => el.innerHTML)
.map(t => ({t, s: Math.random()}))
.sort((a, b) => a.s > b.s ? -1 : 1)
.map(c => c.t);
@stevewithington
stevewithington / docker-compose-drupal-postgres.yml
Last active April 21, 2025 17:47
Drupal with Postgres Docker Compose File
version: '2'
# Note: use the database service name `db` in the Host IP Address field ...
# Or, `docker container inspect {postgrescontainerid}` to obtain the IP Address needed for completing the Drupal setup screen.
services:
# Postgres
db:
image: postgres:9.6.5-alpine
restart: always