Skip to content

Instantly share code, notes, and snippets.

@coldfumonkeh
coldfumonkeh / azure-pipeline.yml
Created July 10, 2020 04:48
Azure Pipeline Snippet
pool:
vmImage: 'ubuntu-16.04'
stages:
- stage: Testing
jobs:
- job: Lucee4
steps:
- script: |
echo Starting the build
<cfscript>
function airwolfMe(
numeric passCount = 1,
array hexArray = []
){
var aw = '0123456789ABCDEF';
var hexArray = arguments.hexArray;
var hexLine = '';
component extends="taffy.core.resource" taffy_uri="/artists" {
/**
* Makes the GET request
*
* @limit The maximum number of records to return per call. Defaults to 5
* @offset The number of records to skip when making the request *used for pagination)
*/
function get(
numeric limit = 5,
@coldfumonkeh
coldfumonkeh / twitterdateformat.cfm
Created December 19, 2012 22:40
Handling Twitter's "interesting" date format in ColdFusion
<cffunction name="parseTwitterDateFormat" output="false" returntype="String" hint="I return the date in a useable date format.">
<cfargument name="twitterDate" required="true" type="string" hint="The Twitter date." />
<cfset var formatter = CreateObject("java", "java.text.SimpleDateFormat").init("EEE MMM d kk:mm:ss Z yyyy") />
<cfset formatter.setLenient(true) />
<cfreturn formatter.parse(arguments.twitterDate) />
</cffunction>
// When you have the details stored in the SESSION scope
application.objMonkehTweet.setFinalAccessDetails(
oauthToken = session['accessToken'],
oauthTokenSecret = session['accessSecret'],
userAccountName = session['screen_name']
);
// When you want to directly pass in the details
authStruct = application.objMonkehTweet.getAuthorisation(
callbackURL='http://127.0.0.1:8500/monkehTweet/authorize.cfm'
);
<cfquery dbtype="query" name="qryFilter">
SELECT *
FROM qryTweets
WHERE from_user_id =
<cfqueryparam cfsqltype="cf_sql_numeric" value="6499262" />
</cfquery>
<!--- Make the request to the API --->
<cfhttp
url="http://search.twitter.com/search.json?q=coldfusion&rpp=10"
method="get"
result="jsonTweets" />
<!--- Convert JSON to array of structs --->
<cfset jsonData = deserializeJSON(jsonTweets.fileContent) />
<!--- Check we have records returned to us --->
@coldfumonkeh
coldfumonkeh / isWithinWebroot.cfm
Last active December 16, 2015 20:39
A quick function to check if a provided file / folder is within the ColdFusion webroot.
<cfscript>
/**
* Returns true if the specified path is within the webroot of the calling server / template.
* It does not check for the existence of the file / directory in the provided path.
*
* @param path A full path to the file / location to query.
* @return Returns a boolean value
* @author Matt Gifford (me@mattgifford.co.uk)
* @version 1.0.0
* @date 1st May 2013
@coldfumonkeh
coldfumonkeh / youtube.cfm
Created October 30, 2015 11:39 — forked from misterdai/youtube.cfm
Youtube cfm?
<cfscript>
urls = [
'//www.youtube-nocookie.com/embed/up_lNV-yoK4?rel=0',
'http://www.youtube.com/user/Scobleizer##p/u/1/1p3vcRhsYGo',
'http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel',
'http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub',
'http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I',
'http://www.youtube.com/user/SilkRoadTheatre##p/a/u/2/6dwqZw0j_jY',
'http://youtu.be/6dwqZw0j_jY',
'http://www.youtube.com/watch?v=6dwqZw0j_jY&feature=youtu.be',