Skip to content

Instantly share code, notes, and snippets.

@newgeekorder
newgeekorder / gist:879664
Created March 21, 2011 15:50
commons io list filtered directory
FilenameFilter fileFilter = new SuffixFileFilter(".html");
File resultDir = new File(testPath);
String[] results = resultDir.list(fileFilter);
for (int i = 0; i < results.length; i++) {
System.out.println(results[i]);
}
@newgeekorder
newgeekorder / siteScrape
Created August 20, 2012 16:59
site scrape
// Print all of the news items on hackernews
var jsdom = require('jsdom');
jsdom.env({
html: 'http://news.ycombinator.com/',
scripts: [
'http://code.jquery.com/jquery-1.5.min.js'
],
done: function(errors, window) {
var $ = window.$;
@newgeekorder
newgeekorder / gist:4721898
Created February 6, 2013 10:56
Working pom.xml to build a mule dev kit connector
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>harp</artifactId>
<groupId>com.bskyb</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.hello</groupId>
<artifactId>hello-connector</artifactId>
@newgeekorder
newgeekorder / groovy xsd validation
Last active December 20, 2015 18:18
Groovy xsd valdiation
import javax.xml.XMLConstants
import javax.xml.transform.stream.StreamSource
import javax.xml.validation.SchemaFactory
class jasonXsdValdation {
static def xml = """
<?xml version="1.0" encoding="UTF-8"?>
<jason>
@newgeekorder
newgeekorder / gist:7675835
Created November 27, 2013 13:40
parallel http calls
import static groovyx.gpars.GParsExecutorsPool.withPool
def restUrl = ["http://url1", "http://url2", "http://url3"]
def poolSize =restUrl.length
withPool(poolSize) {
poolSize.times {
Closure callUrl = {"http://google.com".toURL().withReader {}}
callUrl.callAsync();
}