Skip to content

Instantly share code, notes, and snippets.

View SirRawlins's full-sized avatar

Robert Rawlins SirRawlins

  • Sorry™
  • Chichester, UK
View GitHub Profile
@SirRawlins
SirRawlins / gist:4664075
Last active December 11, 2015 21:39
This is a short process which collectes the directory path of a CFC, and uses it's location to find a related view by convention. For instance, if the CFC path is /mailers/foo/bar.cfc the view location would be /views/email/foo/bar/ This is done simply at the moment by using REGEX to switch the '/mailers/ directory with '/views/email' in the CFC…
<!---
No path for the view was set into the payload so we
render a view based on the conventions.
--->
<!--- Get the full directory path of this mailer object. --->
<cfset LOCAL.MailPath = getDirectoryFromPath(getMetaData(this).path) />
<!--- This path MAY be a windows path, with backslashes so I'm going to normalize this into a NIX path. --->
<cfset LOCAL.MailPath = Replace(LOCAL.MailPath, '\', '/', "ALL") />
@SirRawlins
SirRawlins / gist:4953756
Last active December 13, 2015 18:18
Making curl requests to mimic PostmarkApp Inbound Hook.
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{ "From": "myUser@theirDomain.com", "FromFull": { "Email": "myUser@theirDomain.com", "Name": "John Doe" }, "To": "451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com", "ToFull": [ { "Email": "451d9b70cf9364d23ff6f9d51d870251569e+ahoy@inbound.postmarkapp.com", "Name": "" } ], "Cc": "\"Full name\" <sample.cc@emailDomain.com>, \"Another Cc\" <another.cc@emailDomain.com>", "CcFull": [ { "Email": "sample.cc@emailDomain.com", "Name": "Full name" }, { "Email": "another.cc@emailDomain.com", "Name": "Another Cc" } ], "ReplyTo": "myUsersReplyAddress@theirDomain.com", "Subject": "This is an inbound message", "MessageID": "22c74902-a0c1-4511-804f2-341342852c90", "Date": "Thu, 5 Apr 2012 16:59:01 +0200", "MailboxHash": "ahoy", "TextBody": "[ASCII]", "HtmlBody": "[HTML(encoded)]", "Tag": "", "Headers": [ { "Name": "X-Spam-Checker-Version", "Value": "SpamAssassin 3.3.1 (2010-03-16) onrs-ord-pm-inbound1.wildbit.com" }, { "Name
@SirRawlins
SirRawlins / 2013-01-27-example-article.html
Last active January 4, 2016 16:39
Adding authors to a Jekyll blog
---
# Layout.
layout: post
# Author.
author: robert_rawlins
---
@SirRawlins
SirRawlins / Rakefile
Last active September 15, 2020 06:22
Using Jekyll plugins on GitHub Pages.
# Rquire jekyll to compile the site.
require "jekyll"
# Github pages publishing.
namespace :blog do
#
# Because we are using 3rd party plugins for jekyll to manage the asset pipeline
# and suchlike we are unable to just branch the code, we have to process the site
# localy before pushing it to the branch to publish.
#
@SirRawlins
SirRawlins / url_matcher.rb
Last active August 12, 2022 19:42
RSpec url matcher.
# Drop this into /spec/support/matchers
# Usage: result.should be_url
# Passes if result is a valid url, returns error "expected result to be url" if not.
# Matcher to see if a string is a URL or not.
RSpec::Matchers.define :be_url do |expected|
# The match method, returns true if valie, false if not.
match do |actual|
# Use the URI library to parse the string, returning false if this fails.
URI.parse(actual) rescue false