This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function singleLine(s){ | |
s = replacelist(s, "#chr(9)#,#chr(10)#,#chr(12)#,#chr(13)#,#chr(160)#", " , , , , "); | |
return trim(reReplace(s, "[[:space:]]{2,}", " ", "all")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- NOTE: This technique is not 100% accurate because some DNS servers don't allow MX queries or may be slow to respond, | |
but this will identify addresses that are potentially bad or suspicious. ---> | |
<!--- some elements are incorporated from @pfreitag's post here: https://www.petefreitag.com/item/487.cfm ---> | |
<cfscript> | |
public boolean function isEmailDomainValid( required string email, string dnsServer = '8.8.8.8', numeric timeout = 2000, numeric retries = 1 ){ | |
var mxRecords = []; | |
var emailDomain = email.listLast( '@' ).trim(); | |
if ( !isValid( 'email', email ) ) | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Word and Character Count service for Mac OS X | |
-- Adds a Word and Character Count option to the text selection context menu | |
-- Use Automator to create a new service, then select the Run AppleScript action. Make | |
-- sure the service is set to receive "text", at the top of the window. Paste in this code | |
-- and save as "Word and Character Count". Now switch to a new app, select some text, | |
-- right-click, go to Services, and find the new option. | |
-- Copyright 2015, Noah Slater <nslater@apache.org> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @hint Removes whitespace from HTML code | |
Originally authored by Jordan Clark (JordanClark@telus.net) | |
*/ | |
public string function compressHtml( | |
required string html, | |
numeric level = 2 | |
){ | |
local.response = this.trim(arguments.html); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
struct function hashPasswordPBKDF2 (required string password, numeric iterations = 10000, numeric saltByteLength = 8) { | |
if (iterations < 100000) { | |
throw(message="Iterations must be greater than or equal to 100000"); | |
} | |
if (saltbytelength < 8) { | |
throw(message="SaltByteLength must be greater than or equal to 8"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet | |
# based on the RSnake original http://ha.ckers.org/xss.html | |
# Retrieved on 2013-11-20 | |
# Much of this wildly obsolete | |
# | |
# XSS Locator 2 | |
'';!--"<XSS>=&{()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="getRemoteAddress" output="false" access="public" returntype="string" hint="Identify the remote user IP address"> | |
<cfset var pc = getHTTPRequestData().headers /> | |
<cfset var arrIP = "" /> | |
<cfif structKeyExists(pc, "X-Forwarded-For") AND len(pc["X-Forwarded-For"])> | |
<!--- the x-forwarded-for header sometimes includes values that are too long like "172.27.156.64, 67.98.222.16". The regexp picks out just the matches. http://support.f5.com/kb/en-us/solutions/public/12000/200/sol12264.html ---> | |
<cfset arrIP = reMatch('\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b', pc["X-Forwarded-For"]) /> | |
<cfif arrayLen(arrIP)> | |
<cfreturn arrIP[1] /> | |
<cfelse> |
NewerOlder