Skip to content

Instantly share code, notes, and snippets.

View childnode's full-sized avatar
🐝
Bee here

Marcel Trautwein childnode

🐝
Bee here
View GitHub Profile
@childnode
childnode / build.gradle
Created May 4, 2016 14:35
gradle SNAPSHOTS
dependencies {
{
compile group: 'de.childno.test', name: 'mvn-artefact', version:'+', changing: true
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
package de.childno.test.java.junit;
import com.google.auto.value.AutoValue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@childnode
childnode / rgur.sh
Last active June 24, 2016 10:05
recursive `git update remote` #git #cmdline #script
## usage: `rgur origin currentRemote.example.com newRemote.example.com`
rgur ()
{
test -d .git && ( echo "found git repo in $i" && ( git remote set-url $1 $(git remote get-url $1 |sed -e 's/'$2'/'$3'/') );
echo "UPDATED $1 : $(git remote get-url $1)" ) || ( for i in *;
do
test -d "$i" && ( builtin cd "$i" && rgur $1 $2 $3);
done )
}
@childnode
childnode / rgfa.sh
Last active September 21, 2016 21:27
recursive `git fetch all` #git #cmdline #script
## usage: `rgfa`
rgfa ()
{
test -d .git && ( echo "found git repo in $i" && ( git fetch -a > /dev/null );
echo "done $PWD" ) || ( for i in *;
do
test -d "$i" && ( builtin cd "$i" && rgfa );
done )
}
@childnode
childnode / ServiceModule.java
Created March 7, 2016 16:22
Example Ratpack Server start chain with guice registry and
package de.childno.example.ratpack;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Provides;
public class ServiceModule extends AbstractModule {
@Override
protected void configure() { }
plugins {
id 'application'
id 'com.zoltu.git-versioning' version '2.0.6'
// id 'io.ratpack.ratpack-java' version '1.2.0'
}
repositories {
jcenter()
}
@childnode
childnode / mock_sourceSets.gradle
Created February 26, 2016 08:36
gradle mock sourceSet
sourceSets {
mock {
java.srcDir 'src/mock/java'
output.classesDir sourceSets.main.output.classesDir
resources.srcDir 'src/mock/resources'
output.resourcesDir sourceSets.main.output.resourcesDir
}
}
compileJava.dependsOn compileMockJava
processResources.dependsOn processMockResources
@childnode
childnode / check_JVMlevel_on_JavaCompile.gradle
Last active February 25, 2016 13:46
gradle_java_check_compiler.gradle
tasks.withType(JavaCompile) {
doFirst {
if (!JavaVersion.current().java8Compatible) {
throw new IllegalStateException("Must be built with Java 8 or higher")
}
}
// typical compileJava options
options.encoding = 'UTF-8'
}
@childnode
childnode / idea_directoryBasedConf.gradle
Created February 25, 2016 13:44
gradle idea plugin workaround for dir-based configuration #2
sourceCompatibility = JavaVersion.VERSION_1_8
// !! HAVE TO BE SET AFTER project.sourceCompatibility
idea {
project {
// explicit set to sourceCompatibility since default is JVM level that runs gradle
jdkName = project.sourceCompatibility
outputFile = new File('.idea/modules.xml')
}
}
@childnode
childnode / idea_directoryBasedConf.gradle
Last active February 8, 2017 19:12
gradle idea plugin workaround for dir-based configuration
tasks.withType(GenerateIdeaProject) {
doLast {
copy {
from '.'
into '.idea/'
include '*.ipr'
rename { "modules.xml" }
}
project.delete "${project.name}.ipr"
}