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
@smebberson
smebberson / .gitignore
Created March 9, 2012 11:20
Facebook oAuth and Graph API example
.DS_Store
WEB-INF
@stevereich
stevereich / googleURL.cfc
Created September 27, 2012 05:43
Coldfusion Functions for Google URL Shortener API
<cfscript>
component output="false" {
public googleURL function init(apiKey)
description="Initialize this CFC as an object"
{
variables.apiKey = arguments.apiKey;
return this;
}
public string function ShortenURL(required string url)
@stevereich
stevereich / formatPhone.cfc
Created September 28, 2012 08:20
Function to Format Phone Number with RegEx and Coldfusion
<cfscript>
component output="false" {
public formatPhone function init(){
return this;
}
public string function formatPhone(required string phoneNumber)
description="Strips out anything that isn't a number and then takes the first 10 digits and formats them to our spec: (404) 555-1212"
output="false"
@stevewithington
stevewithington / dsp_custom_search.cfm
Last active March 19, 2021 16:25
Mura CMS: Custom Search Example
<cfoutput>
<div>
<form action="#$.content('url')#?keywords=#$.event('keywords')#">
<dl>
<dt>Keywords</dt>
<dd><input type="text" name="keywords" value="#HTMLEditFormat($.event('keywords'))#" /></dd>
<dd><input type="submit" value="Search" /></dd>
</dl>
@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

@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()>
@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 / 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') ) {
@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 / 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>