Skip to content

Instantly share code, notes, and snippets.

Adam Tuttle atuttle

Block or report user

Report or block atuttle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Replacing TinyMCE with WMD in your Mango Blog.mdown

Replacing TinyMCE with WMD (Markdown) in your MangoBlog

Mango Blog future plans include a way to add custom editors in a manner that is simple and compartmentalized, but this is not yet realized. Therefore, in order to accomplish this goal today, we must edit a few files. Don't worry, it's not difficult and there aren't that many to do.

Of course there are two pieces to this puzzle. First, you have to put a Markdown editor in your blog (directions to follow); then you need a plugin to convert that Markdown into HTML at display-time. I've written a plugin called Salsa to do that.

Step 0: Add assets

Download Unzip it into {Mango}/admin/assets/editors/ so that the directory structure follows:

View stack.cfc
<cfcomponent hint="A stack class that makes working with arrays as stacks clean and simple">
//private data = arrayNew(1);
function init(){
if (!structIsEmpty(arguments)){
if (isArray(arguments[1])){//handle array source data = arguments[1];
View usp_PartsOfSpeech_wordEssayCount.sql
CREATE PROCEDURE [dbo].[usp_PartsOfSpeech_wordEssayCount]
@wordlistInput varchar(max)
--table to hold results
declare @rtn table (
word varchar(50),
recCount int
View git_resources.mdown
View gist:432050
//update-form handler
var frm = $(this);
url: frm.attr('action'),
firstname: $("##update input[name=firstname]").val(),
lastname: $("##update input[name=lastname]").val(),
address: $("##update input[name=address]").val(),
View gist:521400
var values = {};
values.probablyOctal = 000010;
values.whoKnows2 = 00000020;
values.whoKnows3 = 000000030;
values.whoKnows4 = 0000000040;
values.whoKnows5 = 00000000050;
values.whoKnows6 = 000000000060;
values.whoKnows7 = 0000000000070;
values.whoKnows8 = 00000000000080;
values.whoKnows9 = 000090;
View compound_interest.cfm
numeric function getPeriods(required numeric initBalance, required numeric intRate, required numeric desiredTotal) output="false" {
//assume interest rate is of format .5 = 50%
var periods = (log(arguments.desiredTotal) - log(arguments.initBalance))/log(1+arguments.intRate);
return (ceiling(periods));
atuttle / cache.cfc
Created Dec 3, 2010
Simple cache manager for ColdFusion. Relies on the user to store the component instance in a persistent scope (eg Application, Server, or Session)
View cache.cfc
component output="false" {
public function init(){
return this;
public void function put(key, data, timeout){
variables.cache[key] = { timeout=arguments.timeout, };
public boolean function has(key){
return (structKeyExists(variables.cache, arguments.key) && dateCompare(now(),variables.cache[arguments.key].timeout) == -1);
atuttle / deliciousBackupParser.cfc
Created Feb 24, 2011
Parses the HTML export from and returns an array of structures representing the links from delicious.
View deliciousBackupParser.cfc
component {
public function init() output="false" {
return this;
public function parse(data) output="false" {
local.links = [];
//loop over each line in the file
atuttle / artist.cfm
Created Mar 25, 2011
An example of writing REST web services in ColdFusion, without a framework. This code is provided as an example of a simple implementation, but should not be considered a best practice or something I am promoting. I use this in one of my presentations as
View artist.cfm
An example of writing REST web services in ColdFusion, without a framework (and why you should use one).
Provided as an example of a simple implementation, but should not be considered a best practice or something
I am promoting. Not thoroughly tested, not very maintainable, not even that reusable.
<cfsetting enablecfoutputonly="true" showdebugoutput="false" />
<cffunction name="StructKeyRequire" output="false">
<cfargument name="s" type="struct" />
You can’t perform that action at this time.