Skip to content

Instantly share code, notes, and snippets.

@coldfumonkeh
coldfumonkeh / gist:4068955
Created November 13, 2012 22:47
ColdFusion Can't assign requested address
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
Can't assign requested address
ColdFusion cannot determine the line of the template that caused this error. This is often caused by an error in the exception handling subsystem.
Resources:
@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>
@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 ([email protected])
* @version 1.0.0
* @date 1st May 2013
<!--- 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 --->
<cfquery dbtype="query" name="qryFilter">
SELECT *
FROM qryTweets
WHERE from_user_id =
<cfqueryparam cfsqltype="cf_sql_numeric" value="6499262" />
</cfquery>
authStruct = application.objMonkehTweet.getAuthorisation(
callbackURL='http://127.0.0.1:8500/monkehTweet/authorize.cfm'
);
@coldfumonkeh
coldfumonkeh / README.md
Last active August 29, 2015 14:14
Server Detection Scriptlet.. (WTF is a scriptlet?)

ColdFusion Server Detection

This is a re-imagineering of a ColdFusion code block found here: https://github.com/webdevsourcerer/CF-Server-Detect

It is actually originally noted as a ColdFusion Scriptlet but we have NO frickin' idea what a ColdFusion Scriptlet is (because there is no such thing).

Credits

It's ALWAYS good etiquette to credit and thank those who gave time, skills and knowledge to advance the community and help to improve shitty code.

(* Script to record and tag spotify tracks, by Lloyd Moore *)
(* Modified by Tiffany G. Wilson to resolve audio splitting issues, automate starting/stopping, and add recording customization *)
(* Snippets for controlling Spotify are from Johnny B on tumblr (http://johnnyb.tumblr.com/post/25716608379/spotify-offline-playlist) *)
(* The idea of using delayed tagging/filename updating is from a guest user on pastebin (http://pastebin.com/rHqY0qg9) *)
(* The only thing to change in the script is the output format; you must change the file extension and the recording format to match *)
(* Run this script once a song you want to record is queued (stopped at beginning) or playing *)
(* Running the script will initiate hijacking, recording and audio playback *)
(* To stop script, pause Spotify or wait for album/playlist to end*)
(* To set id3 tags, use application Kid3 (http://sourceforge.net/projects/kid3/) and copy '%{artist} - %{album} - %{track} - %{title}' from file name to Tag 2 *)
@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',
// 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