Skip to content

Instantly share code, notes, and snippets.

View robfletcher's full-sized avatar

Rob Fletcher robfletcher

View GitHub Profile

Keybase proof

I hereby claim:

  • I am robfletcher on github.
  • I am robfletcher (https://keybase.io/robfletcher) on keybase.
  • I have a public key whose fingerprint is B0DA 4426 D1D5 1AF0 2D93 F480 9376 AE14 4362 B58E

To claim this, I am signing this object:

@robfletcher
robfletcher / gist:6c049a4c807cedc0e844
Last active August 29, 2015 14:03
This is a list of smaller, lesser-known libraries that I've used and vouch for. It has bookmark value for me as much as anything but I'm keeping it here in the hope someone might find it useful.

Libraries

JVM

Strongly-typed Java interfaces for REST endpoints. Supports returning RxJava Observables. Similar to Feign which is by Netflix but doesn’t support Rx.

@robfletcher
robfletcher / gist:5d9c79aec1c7bb694517
Last active August 29, 2015 14:05
Is this supposed to be able to compile?
import groovy.transform.*
@CompileStatic
class A {
private final String name
A(String name) {
this.name = name
}
}
@robfletcher
robfletcher / build.gradle
Created October 29, 2014 23:51
Example of trying to execute a script from a gem using JRubyExec
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.github.jruby-gradle:jruby-gradle-plugin:0.1.3+"
}
}
def "subscriber receives message"() {
given: "An async event bus"
def eventBus = new AsyncEventBus(Executors.newCachedThreadPool())
and: "A Fake Service"
def vars = new BlockingVariables()
def fakeService = Stub(FictionalService) {
process(_) >> { PersonMessage message -> vars.message = message }
}
@robfletcher
robfletcher / gist:44b115286fd9ef9c8a8c
Last active August 29, 2015 14:11
Difference in static & dynamic code dispatching to field or getter
import groovy.transform.*
//@CompileStatic
class Person {
String name
private List<Person> friends
String friendNames() {
friends.collect { it.name }.join(", ")
}
@robfletcher
robfletcher / gist:b596b90d651370da281c
Created December 12, 2014 22:13
Using Groovy inject to iteratively add things to a fluent builder
JobParameters fromMap(Map<String, String> parameters) {
parameters.inject(new JobParametersBuilder()) { JobParametersBuilder builder, entry ->
builder.addParameter(entry.key, new JobParameter(entry.value))
} toJobParameters()
}
@robfletcher
robfletcher / gist:fb3546d248bf0398d741
Created March 17, 2015 18:53
Test for backpressure when using Observable.interval
@Grab("io.reactivex:rxjava:1.0.8")
import rx.*
import static java.util.concurrent.TimeUnit.*
import static java.time.LocalTime.*
def sub = Observable.interval(1, SECONDS)
.doOnNext { tick->
println "tick $tick at ${now()}"
}
.subscribe { tick ->
@robfletcher
robfletcher / CheckPluginVersions.groovy
Created June 15, 2009 10:19
Grails script that checks the versions of plugins you have installed and notifies you when newer versions are available
import groovy.xml.dom.DOMCategory
includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsPlugins")
def getAvailablePluginVersions = {
def plugins = [:]
eachRepository {repo, url ->
use(DOMCategory) {
pluginsList.'plugin'.each {plugin ->
includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_PluginDependencies")
target('default': "Prepares development environment") {
depends(installPlugins, installDependencies)
event("StatusFinal", ["Done"])
}
target(installPlugins: "Installs all plugins") {
depends(resolveDependencies)