Skip to content

Instantly share code, notes, and snippets.

View dawesi's full-sized avatar

Chris Dawes dawesi

View GitHub Profile
<cfscript>
QueueName = "QTransactions";
durable = true;
loadPaths = arrayNew(1);
loadPaths[1] = expandPath("lib/rabbitmq-java-client-bin-2.8.4/rabbitmq-client.jar");
// load jars
javaLoader = createObject("component", "lib.javaloader.JavaLoader").init(loadPaths);
public string function createRandomString()
{
var rules = { minLength = 8, maxLength = 12 };
var length = randRange(rules.minLength,rules.maxLength,'SHA1PRNG');
var passwd = ['2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','J','K','M','N','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','j','k','m','n','p','q','r','s','t','u','v','w','x','y','z','##','@','$','&','*','+'];
createObject('java','java.util.Collections').shuffle(passwd);
return arrayToList(arraySlice(passwd,1,length),'');
}
// Location to your properties file
var pFile = 'location_to_your_properties_file/filename.properties';
// Init Props
var props = CreateObject("java","java.util.Properties").init();
// Load the file into the props
props.load( CreateObject("java","java.io.FileInputStream").init(pFile) );
// Assume properties file has the following value
// Property1=Foo
// Property2=Bar
@dawesi
dawesi / git_commands
Last active August 29, 2015 14:13 — forked from webRat/git_commands
git init - navigate to the appropriate directory and just type that.
git add . - adds everything in that path
git commit -m 'stuff' - Commits with the message 'stuff'
git branch - views branches
git checkout -b <new branch> - Creates & switches to new branch
git checkout <branch> - switches to branch
git merge <branch> - merges that branch to the existing branch that you're already in.
git branch -d <branch> - deletes branch
git push - This assumes you already have a remote setup (like github)
@dawesi
dawesi / xero.cfc
Created February 10, 2016 10:15 — forked from mjb/xero.cfc
Using CFML (Railo & ColdFusion) to access the the Xero API Private Application.
<!-----------------------------------------------------------------------------------
@@Author: Matthew Bryant
@@Company: TORO Waste Equipment
@@license: The MIT License (http://opensource.org/licenses/MIT)
@@Version: 0.1 $
@@Description: For use with Xero API (https://api.xero.com)
STEP 1. GENERATE SSL KEY
1.1. Download openSSL for windows: http://slproweb.com/products/Win32OpenSSL.html
@dawesi
dawesi / au-states.json
Created May 20, 2019 22:18 — forked from nickhough/au-states.json
JSON Australian States with Abbreviations
[
{
"name":"New South Wales",
"abbreviation":"NSW"
},
{
"name":"Victoria",
"abbreviation":"VIC"
},
{
<html>
<head>
<script type="text/javascript">
function editDiagram(image)
{
var initial = image.getAttribute('src');
image.setAttribute('src', 'http://www.draw.io/images/ajax-loader.gif');
var iframe = document.createElement('iframe');
iframe.setAttribute('frameborder', '0');
@dawesi
dawesi / Google Analytics.js Outbound Link Tracking.js
Created September 15, 2020 12:52 — forked from leighmcculloch/Google Analytics.js Outbound Link Tracking.js
This JavaScript will catch any outbound links and register them with Google Analytics before the browser loads the linked URL. This script works with Google's new analytics.js and not the older ga.js. This script ensures the attempt to register the page with Google Analytics is complete before continuing to load the next page. This capability is…
@dawesi
dawesi / minimal-analytics-snippet.js
Created September 15, 2020 12:59 — forked from DavidKuennen/minimal-analytics-snippet.js
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@dawesi
dawesi / australian-postcodes.sql
Created November 7, 2020 01:00 — forked from randomecho/australian-postcodes.sql
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;