Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@darylteo
darylteo / run
Created February 18, 2013 18:08
Sorry you'll need to do the run script yourself...
#!/bin/bash
javac -cp /Users/dteo/.gradle/caches/artifacts-15/filestore/io.vertx/vertx-platform/2.0.0-SNAPSHOT/jar/aaeed5b66ffe6491ef4546a9b3ca136fc6d2c279/vertx-platform-2.0.0-SNAPSHOT.jar:/Users/dteo/.gradle/caches/artifacts-15/filestore/org.slf4j/slf4j-api/1.6.2/jar/8619e95939167fb37245b5670135e4feb0ec7d50/slf4j-api-1.6.2.jar:/Users/dteo/.gradle/caches/artifacts-15/filestore/log4j/log4j/1.2.16/bundle/7999a63bfccbc7c247a9aea10d83d4272bd492c6/log4j-1.2.16.jar:/Users/dteo/.gradle/caches/artifacts-15/filestore/io.netty/netty/3.6.2.Final/bundle/69be11c61427f0604a30539755add84ad9e37e5e/netty-3.6.2.Final.jar:/Users/dteo/.gradle/caches/artifacts-15/filestore/org.codehaus.jackson/jackson-core-asl/1.9.4/jar/8d8b2a3e5bc77ee1be67d060b44ac77d48a27d6e/jackson-core-asl-1.9.4.jar:/Users/dteo/.gradle/caches/artifacts-15/filestore/org.codehaus.jackson/jackson-mapper-asl/1.9.4/jar/5206191b35112f50b8e25fcbd3f3b84e12e11cee/jackson-mapper-asl-1.9.4.jar:/Users/dteo/.gradle/caches/artifacts-15/filestore/com.hazelcast/hazelcast/2.
@darylteo
darylteo / examples.java
Created February 20, 2013 08:40
Discussion on static accessors
// I don't believe this should be required
public static MyObject hypotheticalFactoryMethod(Vertx vertx){
Vertx.container.getLogger().log("Created");
return new MyObject();
}
// or even this
public static MyObject hypotheticalFactoryMethod(Logger logger){
logger.log("Created");
return new MyObject();
makePromise("Hello World")
.then(new PromiseHandler<String, Character>() {
@Override
public Character handle(String result) {
return result.charAt(0);
}
}, vertx)
.fin(new PromiseHandler<Void, Void>() {
@Override
public Void handle(Void value) {
rsync -avz /path/to/local/sync/folder -e "ssh -i /path/to/ssh/key" ubuntu@ec2instance:/path/to/remote/sync/folder
@darylteo
darylteo / Main.java
Created June 17, 2013 07:58
Reproducing unsuppressed error message in vert.x 2.0.0-CR1
import org.vertx.java.platform.PlatformLocator;
import org.vertx.java.platform.PlatformManager;
public class Main {
public static void main(String args[]){
PlatformManager man = PlatformLocator.factory.createPlatformManager();
}
}
@darylteo
darylteo / Verticle.java
Last active December 24, 2015 04:19
My Crazy Idea?
public class Verticle {
public static void main(String[] args) throws Exception {
StackTraceElement[] stack = Thread.currentThread ().getStackTrace ();
for(StackTraceElement e : stack) {
System.out.println(e);
}
StackTraceElement main = stack[stack.length - 1];
String mainClass = main.getClassName ();
@darylteo
darylteo / sonatype.gradle
Last active December 28, 2015 13:49
Sonatype Configuration for Gradle
apply plugin: 'maven'
apply plugin: 'signing'
project.afterEvaluate {
def release = !project.version.endsWith('-SNAPSHOT')
def sonatypeUsername = project.hasProperty('sonatypeUsername') ? project.sonatypeUsername : '';
def sonatypePassword = project.hasProperty('sonatypePassword') ? project.sonatypePassword: '';
configurations {
@darylteo
darylteo / javadoc.gradle
Last active December 1, 2016 14:53
Add external sources to javadoc.
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile group: 'net.spy', name:'spymemcached', version: '2.10.3'
}
@darylteo
darylteo / build.gradle
Created January 4, 2014 12:41
Getting an Antlr task going in gradle.
repositories {
mavenCentral()
mavenLocal()
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply from: 'gradle/sonatype.gradle'
group = 'com.darylteo'