Skip to content

Instantly share code, notes, and snippets.

Dominic Watson DominicWatson

Block or report user

Report or block DominicWatson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DominicWatson
DominicWatson / a2dp.py
Last active Mar 7, 2017 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
View a2dp.py
#! /usr/bin/env python3.5
"""
####################################################################
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Vahid Mardani
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
View gist:d6ce9527fa3294b286cc
<cfscript>
struct function stripNonDataNgAndJsAttributes( required struct attributes ) {
var patternToKeep = "^((data|ng)\-|on)\S";
return attributes.filter( function( key, value ){
return key.reFindNoCase( patternToKeep );
} );
}
string function structToQueryString( required struct input ) {
@DominicWatson
DominicWatson / gist:0ba1fee4a5ae62d967fa
Created Feb 2, 2016
Another number comparison joyfulness
View gist:0ba1fee4a5ae62d967fa
<cfscript>
dump( '8e2597' == '8e2140' );
</cfscript>
@DominicWatson
DominicWatson / gist:7cc1e1280f9b70c96dfa
Created Jun 4, 2015
Filter member function on strings in Lucee 4.5+
View gist:7cc1e1280f9b70c96dfa
<cfscript>
mystring = "my string";
result = mystring.filter( function( part ){
echo( part );
return part != 'my';
}, " " );
echo( result );
</cfscript>
@DominicWatson
DominicWatson / Wirebox.cfc
Last active Aug 29, 2015
Wirebox.cfc with explicit wiring configuration
View Wirebox.cfc
component extends="coldbox.system.ioc.config.Binder" output=false {
public void function configure() output=false {
map( "myService" )
.to( "services.MyService" )
.asSingleton()
.noAutowire()
.initArg( name="someSetting", value=settings.mySetting )
.initArg( name="somecache", dsl="cachebox:myCache" );
@DominicWatson
DominicWatson / tabs and spaces
Last active Dec 25, 2015
Example code to show tabs and spaces being used for indentation and alignment. To see why tabs don't work for alignement (and spaces do), go into edit mode and change the indent size setting. Watch how the first example breaks and the second does not. The second examples show the advantage of TABS for INDENTATION without breaking alignment when …
View tabs and spaces
<!--- TABS FOR BOTH INDENTATION *AND* ALIGNMENT --->
<cfquery>
select column_a,
column_b,
columb_c
from some_table
inner join another_table on another_table.id = some_table.another_table
</cfquery>
@DominicWatson
DominicWatson / gist:1211688
Created Sep 12, 2011
Some code to make color customization in ColdFusion 9's cfspreadsheet implementation clean
View gist:1211688
<cfscript>
void function spreadsheetSetCustomPalette(required any workbook, required struct palette){
var customPalette = arguments.workbook.getworkbook().getcustompalette();
var color = "";
var colorIndex = 0;
var rgb = "";
for(color in palette){
try{
colorIndex = CreateObject("java", "org.apache.poi.hssf.util.HSSFColor$#UCase( color )#").GetIndex();
You can’t perform that action at this time.