This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface NodeList { | |
public Node item(int index); | |
public int getLength(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task osxApp { | |
dependsOn jar | |
doLast { | |
def dist = "${buildDir}/app/${project.name}.app" | |
mkdir("$dist/Contents/MacOS") | |
mkdir("$dist/Contents/Resources") | |
ant.copy(file: "src/main/app/Info.plist", todir: "$dist/Contents") | |
ant.copy(file: "src/main/app/launcher", todir: "$dist/Contents/MacOS") { | |
filterset { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jar { | |
manifest { | |
attributes( | |
'Main-Class': "${project.group}.foo.Main" | |
) | |
} | |
from configurations.compile.collect { entry -> zipTree(entry) } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BeforeUtil { | |
static <T, R> Function<T, R> before(Consumer<T> before, Function<T, R> function) { | |
return arg -> { | |
before.accept(arg); | |
return function.apply(arg); | |
}; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FunctionalInterface | |
public interface Before<T, R> | |
extends Function<Consumer<T>, | |
Function<Function<T, R>, | |
Function<T, R>>> { | |
static <T, R> Before<T, R> create() { | |
return before -> function -> argument -> { | |
before.accept(argument); | |
return function.apply(argument); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public long create(String sql, String[] keyColumns) throws SQLException { | |
try ( | |
Connection connection = dataSource.getConnection(); | |
PreparedStatement statement = connection.prepareStatement(sql, keyColumns)) { | |
if (statement.execute() == 0) { | |
throw new SQLException("Insert failed, no rows affected."); | |
} | |
try (ResultSet generatedKeys = statement.getGeneratedKeys()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE WORDS(ID BIGINT AUTO_INCREMENT, WORD CHAR(20)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public long create(String sql) throws SQLException { | |
try ( | |
Connection connection = dataSource.getConnection(); | |
Statement statement = connection.prepareStatement(sql, | |
Statement.RETURN_GENERATED_KEYS)) { | |
if (statement.executeUpdate() == 0) { | |
throw new SQLException("Insert failed, no rows affected."); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.1.0-RC1' | |
} | |
} | |
apply plugin: "jacoco" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'java-library' | |
} | |
repositories { | |
jcenter() | |
} | |
ext.moduleName = 'com.github.nwillc.fluentsee' | |
version = '1.0.0' |