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
(defn create-function-call [param expr] | |
"Create an sexp for calling expr with a first argument provided by a promise. | |
If expr is a list (already in form suitable for a function call), insert the first argument at second position, | |
otherwise turn expr into a function call expression, unless the function is an fn, which is simply returned. | |
println -> (fn [param] (println param)) | |
(* 2) -> (fn [param] (* param 2)) | |
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 us.monoid.resty.hack; | |
import javax.net.ssl.*; | |
import java.security.*; | |
import java.util.List; | |
/** Glorious hack to always create an SSL Engine with a hostname and port. | |
* engineGetServerSessionContext and engineGetClientSessionContext can't be implemented without violating class/module loading constraints, | |
* but for some reason, they are not being called. | |
* */ |
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
// TODO add imports | |
public class QuickstartSample { | |
public static void main(String... args) throws Exception { | |
Topic t = TopicAdmin.getDefault().createTopic("my-new-topic"); | |
System.out.printf("Topic %s:%s created.\n", topic.getProject(), topic.getName()); | |
} | |
} |
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
#!/usr/bin/env bash | |
JJS=$(type -p $JDK_HOME/bin/jjs || type -p jjs) | |
if [ -z $JJS ]; then | |
echo "I can't find jjs. Please install JDK 8 or set JDK_HOME."; exit 1 | |
fi | |
JS=$(mktemp $(basename "$0").XXXXXX) | |
tail -n+12 "$0" > $JS | |
$JJS -scripting $JS -- "$@" | |
rm $JS | |
exit 0; |
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
(function(){ | |
var json = JSON.parse(document.getElementsByTagName('pre')[0].innerText); | |
var result = JSON.parse(json.result); | |
document.getElementsByTagName('BODY')[0].appendChild(document.createTextNode("Result to convert: " + JSON.stringify(result, null, 2))); | |
// mock data | |
result = { | |
"result":[ | |
{ | |
"receiver_rank":1, |
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.util.ArrayList; | |
import java.util.List; | |
import java.util.function.BiConsumer; | |
import java.util.function.Consumer; | |
/** | |
* Created by beders on 7/7/15. | |
*/ |
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
bus.register(msg -> { System.out.println("I gots a message") }); | |
bus.register((msg,param) -> { System.out.println("I gots a message w/ params"); }); |
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 com.saffrontech.vertx; | |
import io.vertx.core.AsyncResult; | |
import io.vertx.core.Handler; | |
import io.vertx.core.MultiMap; | |
import io.vertx.core.Vertx; | |
import io.vertx.core.buffer.Buffer; | |
import io.vertx.core.eventbus.DeliveryOptions; | |
import io.vertx.core.eventbus.Message; | |
import io.vertx.core.http.WebSocket; |
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
// List running Java Processes | |
// ansicolors | |
var a = { reset : "\u001B[0m", black: "\u001B[30m", red: "\u001B[31m", green: "\u001B[32m", | |
yellow: "\u001B[33m", blue: "\u001B[34m", purple: "\u001B[35m", cyan: "\u001B[36m", | |
white: "\u001B[37m" | |
}; | |
var jps = `jps -vl`.split('\n').slice(0,-1); | |
var ownPID = java.lang.management.ManagementFactory.getRuntimeMXBean().getName().split('@')[0]; |
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 com.saffrontech.ws.vertx.problem; | |
import io.vertx.core.AbstractVerticle; | |
import io.vertx.core.DeploymentOptions; | |
import io.vertx.core.Vertx; | |
import io.vertx.ext.apex.Router; | |
import io.vertx.ext.apex.handler.sockjs.BridgeOptions; | |
import io.vertx.ext.apex.handler.sockjs.SockJSHandler; | |
// curl http://localhost:8888/eventbus/info |
NewerOlder