Skip to content

Instantly share code, notes, and snippets.

View bardware's full-sized avatar

Bernhard Döbler bardware

View GitHub Profile
{
"telemetry.enableTelemetry": false,
"telemetry.enableCrashReporter": false,
"editor.fontSize": 12,
"editor.fontLigatures": true,
"editor.fontFamily": "Fira Code",
"editor.cursorStyle": "line",
"editor.rulers": [
80,
120
<cfset oJSOUP = CreateObject("java", "org.jsoup.Jsoup" )>
<cfset oJSOUPWL = CreateObject("java", "org.jsoup.safety.Whitelist" ).init()>
<cfdump var="#oJSOUP#" expand="false">
<cfdump var="#oJSOUPWL#" expand="false">
<cfdump var="#oJSOUPWL.relaxed()#" expand="false">
<cfdump var="#oJsoup.clean('<a href="link.html"><img src="http://example.com/bild.gif"></a>', oJSOUPWL.relaxed().addAttributes("a", ["href", "class"] ).addAttributes("img", ["src", "class", "styles", "width", "height"] ).removeProtocols("a", "href", ["ftp", "http", "https", "mailto"]).removeProtocols("img", "src", ["http", "https"]) )#">
<cfdump var="#oJsoup.clean('<a href="link.html"><img src="http://example.com/bild.gif"></a>', "http://example.com/", oJSOUPWL.relaxed().preserveRelativeLinks(true))#">
@bardware
bardware / box.log
Created March 23, 2018 11:01
Commandbox variable [NEWCONTENT] doesn't exist
CommandBox:stmelfposy> utils normalize-line-endings *.txt --type windows
Confirm normalizing line endings for 179 files : y
ERROR (3.9.2+00826)
variable [NEWCONTENT] doesn't exist
C:\Users\bddoeble\.CommandBox\cfml\system\modules_app\utils-commands\commands\utils\normalize-line-endings.cfc: line 95
93: }
94:
95: if ( content != newContent ) {
{
"extends": ["plugin:prettier/recommended"],
"rules": {
"newline-after-var": "error"
}
}
@bardware
bardware / Application.cfc
Created December 11, 2017 21:27
Component [site1.Application] has no accessible Member with name [WEBROOT]
<cfcomponent>
<cfset this.name = Hash( GetCurrentTemplatePath() )>
<cfset this.webroot = GetDirectoryFromPath(GetCurrentTemplatePath())>
</cfcomponent>
@bardware
bardware / parseDateTime.cfm
Last active December 7, 2017 18:33
Different output in ACF 11 and 2016
<cfset dNow = Now()>
<cfset dateTimeVar = #dateTimeFormat( dNow, "yyyy.MM.dd HH:nn:ss" )# />
<cfdump var="#dNow#">
<cfdump var="#dateTimeVar#">
<cfoutput>
#parseDateTime( dateTimeVar, "yyyy.MM.dd HH:mm:ss" )#
#parseDateTime( dateTimeVar, "yyyy.MM.dd HH:nn:ss" )#
</cfoutput>
@bardware
bardware / dafuq.txt
Last active April 5, 2018 22:20
Was das?
̶𝕭̶̶ 𝖗̶̶ 𝖆̶̶ 𝖚̶̶ 𝖓̶̶ 𝖐̶̶ 𝖔̶̶ 𝖍̶̶ 𝖑̶̶ 𝖊̶
http://qaz.wtf/u/convert.cgi?text=Braunkohle
<!--- https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/package-summary.html --->
<cfset oCSV = createobject( "java", "org.apache.commons.csv.CSVFormat" )>
<cfset oParserObj = createobject( "java", "org.apache.commons.csv.CSVParser" )>
<cfdump var="#oParserObj#" expand="false">
<cfset oIOFile = createobject( "java", "java.io.File" ).init( expandpath( "./CLIENTIMPORT.csv" ) )>
<cfset oCharset = createobject( "java", "java.nio.charset.StandardCharsets" )>
<cfset oFormat = oCSV.EXCEL.withDelimiter( "|").withFirstRecordAsHeader().withQuote(javacast("char","")).withRecordSeparator("\r\n")>
<cfdump var="#oIOFile#" expand="false">
@bardware
bardware / ListFilter.001.cfm
Created August 23, 2017 17:10
How to use Coldfusion's ListFilter in a function?
<cffunction name="fktA" returntype="string">
<cfargument name="struExcludeCols" type="struct">
<cfset local.strLst = "Listel1,Listel2,Listel3">
<cfscript>
local.columnNames = ListFilter(
strLst,
function( strCol ) {
return not StructKeyExists( Arguments.struExcludeCols, strCol );
@bardware
bardware / EncodeForHTML.cfm
Last active August 11, 2017 12:04
Adobe Encodes forward slash as &#x2f;
<!--- https://medium.com/@gokulraj/esapis-encodeforhtml-vs-encodeforhtmlattribute-79958c07ba0d --->
<cfset str = "HFW int. 18/2015">
<cfset stru = {
strHTMLEditFormat = HTMLEditFormat(str),
strEncodeForHTML = EncodeForHTML(str),
strEncodeForHTMLAttribute = EncodeForHTMLAttribute(str),
strEncodeForJavaScript = EncodeForJavaScript(str),
str = str
}>