Skip to content

Instantly share code, notes, and snippets.

View thomasdarimont's full-sized avatar
🏠
Working from home

Thomas Darimont thomasdarimont

🏠
Working from home
View GitHub Profile
@XmlType(name = "\n\n\tHello World!\n\n")
class Con {}
public class ConHW{}
@thomasdarimont
thomasdarimont / 001_BusinessService.java
Last active August 29, 2015 14:06
How to overwrite nested dependencies for an integration test.
package demo.business;
public interface BusinessService {
void businessMethod();
}
@thomasdarimont
thomasdarimont / xd-dsl.groovy
Created October 14, 2014 11:04
PoC Sketch of an DSL for XD.
class Event{
long ts;
int h;
int hh;
int p;
int property;
double value;
}
class LoadEvent extends Event{
package bob.asm;
/**
* @author Thomas Darimont
*/
public interface BeanAccessor {
Object getProperty(String name);
void setProperty(String name, Object value);
@thomasdarimont
thomasdarimont / Readme.md
Last active August 29, 2015 14:07
Simple monitoring application. Watches for the existence of a process and automatically restarts it if missing or kills it if it is not wanted. Configurable via a control-file.

#Usage

appmonitor "logical_app_name" "complete start command" "complete kill command" "path to control file"

#Example

appmonitor "calculator" "/Applications/Calculator.app/Contents/MacOS/Calculator" "pkill -9 'Calculator'" "/tmp/calculator.control"

If you're coming to the Property-Based TDD As If You Meant It Workshop, you will need to bring a laptop with your favourite programming environment, a property-based testing library and, depending on the language, a test framework to run the property-based-tests.

Any other languages or suggestions? Comment below.

.NET (C#, F#, VB)

Python:

@thomasdarimont
thomasdarimont / sdjpa.support-not-contains.patch
Created October 20, 2014 18:30
Prototypic support for NotContaining part expression for Spring Data JPA.
Mon Oct 20 20:28:24 2014 +0200 5a416d0 (HEAD, feature/support-not-contains) DATAJPA-XXX - Add support for notContains in derived queries.  [Thomas Darimont]
diff --git a/pom.xml b/pom.xml
index bbe0973..c49b1cc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
<hsqldb1>1.8.0.10</hsqldb1>
<jpa>2.0.0</jpa>
<openjpa>2.3.0</openjpa>
- <springdata.commons>1.10.0.BUILD-SNAPSHOT</springdata.commons>
@thomasdarimont
thomasdarimont / InnerWithoutFinal.java
Created October 20, 2014 23:38
Access fields from outer scope within anonymous inner classes without final modifier in Java 8
package de.tutorials.training;
import java.util.Arrays;
public class InnerWithoutFinal {
public static void main(String[] args) {
new Runnable(){
public void run() {
System.out.println(Arrays.toString(args));
@thomasdarimont
thomasdarimont / SimplifySam.java
Created October 21, 2014 09:15
Simplify SAM Type incocations.
Function<String,String> fun = (s)->s;
String funResult = fun.apply("foo"); //conventional way
//String funResult = funResult("foo"); //suggestion
Supplier<String> sup = () -> "bubu";
String supResult = sup.get(); //conventional way
//String supResult = sup(); //suggestion
Consumer<String> con = (s) -> System.out.println(s);
con.accept("bar"); //conventional way
@thomasdarimont
thomasdarimont / cmd_line.txt
Last active August 29, 2015 14:07
Example honest profiler output for a Spring Data MongoDB run.
java -cp $JAVA_HOME/lib/tools.jar:target/honest-profiler.jar com.insightfullogic.honest_profiler.delivery.console.ConsoleEntry -log /Users/tom/Documents/dev/repos/spring/spring-data-examples/rest/starbucks/log.hpl -filter "class: org.springframework.data" > log_sd.txt