This file contains hidden or 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> | |
/* 1/24/2011 james Moberg [email protected] | |
@param numberofChars, number of characters (Optional, 12 = default) | |
@param d, date/time string or object (Optional, now() = default) | |
@return Returns a yyyyMMddHHmmssll string (depending on length of numberofChars.) | |
Updated 20220903 to support millisecond */ | |
string function dateHash(numeric numberofChars=12, date=now()) hint="I convert a date object to yyyymmddHHmmssll" { | |
var response = ''; | |
if(not isvalid("date", arguments.date)) { | |
arguments.date = now(); |
This file contains hidden or 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
<!--- 2/21/2014 ColdFusion Number Test | |
What is an integer? Validity, identification & parsed values should be consistent across all ColdFusion functions & tags. A "non-breaking space" chr(160) has been added to tests as I occassionally seen this character imported via CFSpreadsheet. ---> | |
<cfset isRailo = isDefined("Server.Railo")> | |
<cfset nbsp = chr(160)> | |
<cfset BadValues = ["1 5", " 5", "5 ", "3.14", ".99", "2.00", "2147483648", "005", "1+1", "5-1", "2/1", "3*2", "5#nbsp#", "#nbsp#5", "1#nbsp#5", "6,0", "0,6", "1,000", "$1,000", "$,1,2,$,2352345,$", "1,2,3,4"]> | |
<cfset c = 0> | |
<cfset TestQuery = QueryNew("i","integer")> | |
<cfset queryaddRow(TestQuery)> |
This file contains hidden or 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
/*! | |
* Pikaday 1.2.0 (Downloaded on 3/6/2014) | |
* | |
* Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday | |
* DateJS modifications by James Moberg | 3/6/2014 | http://about.me/jamesmoberg | |
*/ | |
(function (root, factory) | |
{ | |
'use strict'; |
This file contains hidden or 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
<cfhttp url="http://target_website_with-table.com/" username="#CGI.Http_User_Agent#"></cfhttp> | |
<cfscript> | |
jsoup = CreateObject("java", "org.jsoup.Jsoup"); | |
HTMLDocument = jsoup.parse(CFHTTP.fileContent); | |
/* Identify a specific table containing the data to scrape */ | |
TheTable = HTMLDocument.select("##tableByID"); | |
/* Alternate DOM select methods if table doesn't have a unique ID |
This file contains hidden or 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
<!-- Compatible with ColdFusion 8-11. | |
4/28/2015 Rewritten to compensate for new undocumented CF10/11 behavior regarding getHTTPRequestData(). | |
https://bugbase.adobe.com/index.cfm?event=bug&id=3042675 | |
https://bugbase.adobe.com/index.cfm?event=bug&id=3581691 | |
http://www.bennadel.com/blog/2824-gethttprequestdata-may-break-your-request-in-coldfusion-but-gethttprequestdata-false-may-not.htm | |
---> | |
<cffunction name="isAjaxRequestPost" output="false" returntype="boolean" access="public"> | |
<cfset var response = StructNew()> | |
<cfset response.AjaxHeader = getPageContext().getRequest().getHeader("X-Requested-With") /> |
This file contains hidden or 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
<!--- | |
CFHTTP https://wikidocs.adobe.com/wiki/display/coldfusionen/cfhttp | |
HTTPRequestCF http://coldfusion9.blogspot.com/2012/03/custom-cfhttp-tag.html | |
CFX_HTTP5 http://www.cftagstore.com/tags/cfxhttp5.cfm | |
Here are the results that I received: | |
ColdFusion 10 CFHTTP: 9.04 CFC: 18.14 CFX_HTTP5: 1.26 | |
ColdFusion 9 CFHTTP: 8.08 CFC: 158.92 CFX_HTTP5: 2.4 | |
ColdFusion 8 CFHTTP: 4.86 CFC: 149.14 CFX_HTTP5: 2.14 | |
---> |
This file contains hidden or 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
# enable iispeed on this website | |
IISpeed on | |
#IISpeed diagnose | |
# enable certain filters | |
# more filters at http://www.iispeed.com/pagespeed/optimizations | |
IISpeed RewriteLevel CoreFilters | |
IISpeed EnableFilters insert_dns_prefetch | |
IISpeed EnableFilters collapse_whitespace,trim_urls |
This file contains hidden or 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. ---> | |
<cfscript> | |
function isEmailDomainValid(email){ | |
var local.email = arguments.email; | |
var local.DNSServer = '8.8.8.8'; /* Google DNS */ | |
var local.timeout = 2000; | |
var local.attempts = 1; | |
var local.valid = true; | |
var local.emailDomain = trim(listlast(local.email,'@')); |
This file contains hidden or 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> | |
/* based on info from http://googlewebmastercentral.blogspot.com/2006/09/how-to-verify-googlebot.html */ | |
badBot = 0; | |
blockBadBots = 0; | |
ip = cgi.remote_addr; | |
userAgent = CGI.Http_User_Agent; | |
/* Sample request values */ | |
//userAgent = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"; | |
//ip = "179.179.65.180"; //bad |