Skip to content

Instantly share code, notes, and snippets.

@flowersinthesand
flowersinthesand / gist:d8d51bdf5d6e498a4a02
Created August 28, 2014 13:53
Get ms from mocha test log
var fileName = 'a'
var fs = require('fs');
var file = fs.readFileSync(fileName).toString();
var re = /\((\d*)ms\)/mg;
var result = [];
while(ret = re.exec(file)) {
result.push(+ret[1]);
re.lastIndex = ret.index + 1;
}
@flowersinthesand
flowersinthesand / gist:3faee0b75ae2d3e11b92
Created August 11, 2014 18:02
Test log of Vibe Java Server
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Vibe Java Server Parent
[INFO] Vibe Java Server
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Vibe Java Server Parent 3.0.0-Alpha1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
package org.atmosphere.vibe.server;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.ServletContainerInitializer;
@flowersinthesand
flowersinthesand / gist:57badbc1df594c00a0d4
Last active August 29, 2015 14:03
Test result of Vibe Java Server
Donghwan@DONGHWAN ~/Documents/GitHub/vibe (master)
$ mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Vibe Java Server
[INFO] vibe
[INFO]
[INFO] ------------------------------------------------------------------------
@flowersinthesand
flowersinthesand / gist:60ccb8a667c406316b42
Created July 5, 2014 16:35
Test result of Vibe JavaScript Client
Donghwan@DONGHWAN ~/Documents/GitHub/vibe-javascript-client (master)
$ npm test
> vibe-client@3.0.0-Alpha1 test c:\Users\Donghwan\Documents\GitHub\vibe-javascript-client
> grunt test
Running "test-node" task
client
@flowersinthesand
flowersinthesand / a.js
Created June 2, 2014 09:51
Clean all sauce tests
// Open a console in https://saucelabs.com/ and type this script
var username = "vibe";
$.ajax("/rest/v1/" + username + "/jobs").done(function(array) {
(function remove(id) {
$.ajax("/rest/v1/" + username + "/jobs/" + id, {type: "DELETE"})
.done(function() {
if (array.length) {
remove(array.shift().id);
} else {
console.log("done");
@flowersinthesand
flowersinthesand / react.d.ts
Last active August 29, 2015 14:00
Definition for react - incomplete
declare module react {
export function open(uri: string, options?: SocketOptions): Socket;
interface SocketOptions {
transports?: string[];
timeout?: any;
heartbeat?: any;
sharing?: boolean;
reconnect? (lastDelay: number, attempts: number): any;
xdrURL? (url: string): string;
@flowersinthesand
flowersinthesand / Server.java
Last active August 29, 2015 14:00
Draft API for Server and Socket based on Java 8 support
// Java 7
server.byTag("admin", new Action<Socket>() {
@Override
public void on(Socket socket) {
socket.send("message", "you're fired"));
}
});
// or using sentence
server.byTag("admin").send("message", "you're fired");
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script src="http://atmosphere.github.io/react/javascript-client/3.0.0-Alpha1/react.js"></script>
</script>
</body>
@flowersinthesand
flowersinthesand / Application.java
Created April 23, 2014 13:46
Test Java 8 lambda
import io.react.runtime.DefaultServer;
import io.react.runtime.Server;
import io.react.vertx.VertxServerHttpExchange;
import io.react.vertx.VertxServerWebSocket;
import java.io.IOException;
import org.vertx.java.core.Vertx;
import org.vertx.java.core.VertxFactory;