This file contains 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
package example | |
import java.time._ | |
case class Event(description: String, time: Option[ZonedDateTime]) | |
object Event { | |
def apply(description: String) = new Event(description, None) | |
def apply(description: String, time: ZonedDateTime) = new Event(description, Some(time)) | |
} |
This file contains 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
@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 -> |
This file contains 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
JobParameters fromMap(Map<String, String> parameters) { | |
parameters.inject(new JobParametersBuilder()) { JobParametersBuilder builder, entry -> | |
builder.addParameter(entry.key, new JobParameter(entry.value)) | |
} toJobParameters() | |
} |
This file contains 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
import groovy.transform.* | |
//@CompileStatic | |
class Person { | |
String name | |
private List<Person> friends | |
String friendNames() { | |
friends.collect { it.name }.join(", ") | |
} |
This file contains 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
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 } | |
} |
This file contains 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 "com.github.jruby-gradle:jruby-gradle-plugin:0.1.3+" | |
} | |
} |
This file contains 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
import groovy.transform.* | |
@CompileStatic | |
class A { | |
private final String name | |
A(String name) { | |
this.name = name | |
} | |
} |
This file contains 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
/* | |
* This script will scrape text posts from a Tumblr blog and export them as `.md` | |
* files with YAML frontmatter ready to be used in a Middleman blog. | |
* | |
* Aliases are added for the _middleman-alias_ gem so Tumblr style URLs like | |
* `/post/{id}/{slug}` will redirect to the Middleman-style URL. | |
* | |
* Although I built this for migrating to Middleman it should be pretty easy to | |
* adapt this for any similar static site generator. | |
*/ |
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: