Skip to content

Instantly share code, notes, and snippets.

View mjclemente's full-sized avatar

Matthew J. Clemente mjclemente

View GitHub Profile
@mjclemente
mjclemente / create-digitalocean-servers.sh
Last active March 24, 2021 10:16
Create Docker Hosts on DigitalOcean with Docker Machine
#!/bin/bash
#Based on: https://github.com/BretFisher/dogvscat/blob/master/create-servers.sh
#For more details, see: https://blog.mattclemente.com/2018/07/15/create-docker-nodes-on-digitalocean-with-shell-script.html
#Approach without Docker Machine: https://gist.github.com/mjclemente/ada1a591bce5f4fedcd6d6d992d95705
args=(
--driver=digitalocean
--digitalocean-access-token="${DO_TOKEN}"
@mjclemente
mjclemente / create-docker-servers-doctl.sh
Last active March 19, 2021 15:30
Create Docker Hosts on DigitalOcean with doctl
#!/bin/bash
#For more details, see: https://blog.mattclemente.com/2019/03/04/script-docker-host-creation-digitalocean-doctl.html
DO_DROPLET_NAME=docker-node
DO_SIZE=s-1vcpu-1gb
DO_REGION=nyc1
DO_SSH_IDS=$(doctl compute ssh-key list --no-header --format ID)
DO_TAGS=demotag
DO_DROPLET_COUNT=3
@mjclemente
mjclemente / RetryProxy.cfc
Created March 4, 2021 20:50 — forked from bennadel/RetryProxy.cfc
Creating A Generic Proxy For Retry Semantics In ColdFusion
component
output = false
hint = "I provide automatic retry functionality around the target component."
{
/**
* I initialize the retry proxy with the given target component. Retries will
* only be applied to "transient" errors. And, since the proxy doesn't know which
* errors are transient / retriable, it must check with the isTransientError()
* function.
@mjclemente
mjclemente / fork forced sync
Created February 5, 2021 18:38 — forked from glennblock/fork forced sync
Force your forked repo to be the same as upstream.
git remote add upstream https://github.com/some_user/some_repo
git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force
component hint="wrapper for Salesforce REST 2.0 API" {
pageEncoding "utf-8";
/**
Copyright (C) 2012 Daniel Watt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
@mjclemente
mjclemente / date.cfc
Created March 7, 2020 11:30
Get File Creation Date with Java and ColdFusion
// Sourced from https://stackoverflow.com/a/41191422
// Get file attributes using NIO
var nioPath = createObject("java", "java.nio.file.Paths").get( filePath, [] );
var nioAttributes = createObject("java", "java.nio.file.attribute.BasicFileAttributes");
var nioFiles = createObject("java", "java.nio.file.Files");
var fileAttr = nioFiles.readAttributes(nioPath, nioAttributes.getClass(), []);
writeDump( var='#parseDateTime(fileAttr.creationTime().toString())#', abort='true' );
@mjclemente
mjclemente / singleLine.cfm
Created October 10, 2019 20:00 — forked from JamoCA/singleLine.cfm
ColdFusion UDF to trim, strip multiple spaces and remove undesireable space characters (non-breaking space, tab, line feed, carriage return)
function singleLine(s){
s = replacelist(s, "#chr(9)#,#chr(10)#,#chr(12)#,#chr(13)#,#chr(160)#", " , , , , ");
return trim(reReplace(s, "[[:space:]]{2,}", " ", "all"));
}
@mjclemente
mjclemente / syntax.css
Last active June 27, 2019 10:38 — forked from edwardhotchkiss/syntax.css
Solarized Light Pygments CSS / Jekyll
.highlight {
background-color: #efefef;
border: 1px solid #ddd;
-moz-box-shadow: 1px 1px rgba(0,0,0,0.1);
-webkit-box-shadow: 1px 1px rgba(0,0,0,0.1);
box-shadow: 1px 1px rgba(0,0,0,0.1);
overflow: hidden;
}
@mjclemente
mjclemente / task.cfc
Created January 17, 2019 20:04 — forked from bdw429s/task.cfc
CommandBox Task Runner to download packages from RiaForge
/**
* Scrape all the binaries from RiaForge
*/
component {
property name="progressableDownloader" inject="ProgressableDownloader";
property name="progressBar" inject="ProgressBar";
function run() {
directoryCreate( resolvePath( 'downloads' ), true, true );
var projects = deserializeJSON( fileRead( 'http://riaforge.org/index.cfm?event=json.projects' ) );
@mjclemente
mjclemente / acf-bug-check.md
Last active February 22, 2018 20:34
PUT/PATCH request body being lost on Windows Server, IIS 8... but not with built-in web server

When I run the following with ColdFusion's built-in web server, the content of the request shows the request body

When I run it on a Windows Server, running IIS 8, the request body is empty. That is, the body of the PUT or PATCH request is lost. POSTs are handled without issue.

Also, it doesn't matter if the PUT/PATCH originates from ColdFusion or from an external source, like Postman; the result is the same.

In both cases, I'm running ACF 11.

Content of index.cfm