Skip to content

Instantly share code, notes, and snippets.

View bardware's full-sized avatar

Bernhard Döbler bardware

View GitHub Profile
<cfset test = new MyTest() />
<cfset test.newMethod() />
<cfscript>
qryPers = QueryNew(
'pn_id,vor name,nach name',
'integer,varchar,varchar',
[
{ pn_id = 2, 'vor name' = 'L', "nach name" = "y" },
{ pn_id = 1, 'vor name' = 'A', "nach name" = "b" }
]
);
qryPersSort = QueryExecute(
{
"parser" : "espree",
"env" : {
"browser" : true,
"jquery" : true
},
"rules" : {
"no-alert" : "off",
"no-array-constructor" : "warn",
"no-bitwise" : "off",
@bardware
bardware / tweets.sql
Last active July 16, 2017 12:52
Import tweets.csv into MySQL DB
CREATE TABLE `tweets` (
`tweet_id` bigint(11) NOT NULL,
`in_reply_to_status_id` bigint(11) NOT NULL,
`in_reply_to_user_id` bigint(11) NOT NULL,
`timestamp` varchar(100) COLLATE utf8mb4_german2_ci NOT NULL,
`source` varchar(4000) COLLATE utf8mb4_german2_ci NOT NULL,
`text` varchar(4000) COLLATE utf8mb4_german2_ci DEFAULT NULL,
`retweeted_status_id` bigint(11) DEFAULT NULL,
`retweeted_status_user_id` bigint(11) DEFAULT NULL,
`retweeted_status_timestamp` bigint(11) DEFAULT NULL,
@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
}>
@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 );
<!--- 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 / dafuq.txt
Last active April 5, 2018 22:20
Was das?
̶𝕭̶̶ 𝖗̶̶ 𝖆̶̶ 𝖚̶̶ 𝖓̶̶ 𝖐̶̶ 𝖔̶̶ 𝖍̶̶ 𝖑̶̶ 𝖊̶
http://qaz.wtf/u/convert.cgi?text=Braunkohle
@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 / 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>