Skip to content

Instantly share code, notes, and snippets.

@bro1
bro1 / extract.bat
Created October 15, 2015 04:03
Use 7zip on Windows to extract all files in a given directory
setlocal
set path=%path%;C:\apps\7-Zip
FOR /R . %%I IN (*.gz) DO 7z x "%%I" -aou -o"%%I.dir"
FOR /R . %%I IN (*.tar) DO 7z x "%%I" -aou -o"%%I.dir"
FOR /R . %%I IN (*.zip) DO 7z x "%%I" -aou -o"%%I.dir"
@bro1
bro1 / dojo-prevent-submit.js
Created October 10, 2015 02:39
dojo 1.10 prevent a form from being submitted (e.g. due to validation)
submitValidate : function() {
var theForm = dom.byId("patternForm");
on(theForm, "submit", function(ev) {
console.log("form invoked");
ev.preventDefault();
});
}, // end submitValidate
@bro1
bro1 / pom.xml
Created September 3, 2015 11:01
Dependency that you need to add in order to use log4j2 with the commons-logging
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.3</version>
</dependency>
@bro1
bro1 / gist:4719831
Created February 6, 2013 02:53
Scala save pretty XML
val myXML = <top><test></test></top>
val prettyPrinter = new scala.xml.PrettyPrinter(80, 2)
val formattedString = prettyPrinter.format(myXML)
val fos = new FileOutputStream("outfile.xml")
val fps = new PrintWriter(fos);
fps.write(formattedString)
fps.close()