Skip to content

Instantly share code, notes, and snippets.

💭
Coding the Future

Julien Viet vietj

💭
Coding the Future
Block or report user

Report or block vietj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View collector.java
package io.vertx.mysqlclient;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.Tuple;
import java.util.function.BiConsumer;
import java.util.function.Function;
public class Main {
View bbq2019.md

BBQ fin d'année

20 personnes.

Saucisses (Nico)

  • 35 mergez et 35 saucisses de chez El Tayeb

Pain (Joel)

View gist:93e23b2666e8bffc56d6ff100f171035
private static int branchless1(byte c) {
// 48 == 11 0000
// 49 == 11 0001
// 50 == 11 0010
// 57 == 11 1001
byte b1 = (byte) ((c & 0b0001_0000) >> 4);
byte b2 = (byte) ((c & 0b0010_0000) >> 5);
byte b3 = (byte) ((c & 0b0100_0000) >> 6);
byte b4 = (byte) ((c & 0b1000_0000) >> 7);
byte b5 = (byte) (b1 & b2 & ~b3 & ~b4);
View gist:8487068daddfb521c6b954a5aee84e65
private static int indexOf(byte c) {
if (c == '-') {
return 26;
} else if (c >= '0' && c <= '9') {
return c;
} else if (c >= 'A' && c <= 'Z') {
return c - 'A';
} else if (c >= 'a' && c <= 'z') {
return c - 'a';
} else {
View test.java
public Scope receiveRequest(Map<Object, Object> context, Object request, String operation, Iterable<Map.Entry<String, String>> headers, Iterable<Map.Entry<String, String>> tags) {
SpanContext sc = tracer.extract(Format.Builtin.HTTP_HEADERS, new TextMap() {
@Override
public Iterator<Map.Entry<String, String>> iterator() {
return headers.iterator();
}
@Override
public void put(String key, String value) {
throw new UnsupportedOperationException();
}
View streams.adoc

Streams

There are several objects in Vert.x that allow items to be read from and written.

In previous versions the io.vertx.core.streams package was manipulating Buffer objects exclusively. From now, streams are not coupled to buffers anymore and they work with any kind of objects.

In Vert.x, write calls return immediately, and writes are queued internally.

View tracing-test.java
package io.vertx.tracing.jaeger;
import io.jaegertracing.internal.JaegerSpanContext;
import io.opentracing.Scope;
import io.opentracing.Span;
import io.opentracing.SpanContext;
import io.opentracing.Tracer;
import io.opentracing.propagation.Format;
import io.opentracing.propagation.TextMap;
import io.opentracing.tag.Tags;
View gist:720776c277b04884bc1bd1f733656bfe
/*
* Copyright (c) 2011-2018 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/
View gist:51e68aa1f6a9c0490dfd83ea3359e0a0
[INFO] +- io.swagger.parser.v3:swagger-parser:jar:2.0.5:compile
[INFO] | +- io.swagger.parser.v3:swagger-parser-v2-converter:jar:2.0.5:compile
[INFO] | | +- io.swagger:swagger-parser:jar:1.0.39:compile
[INFO] | | | \- io.swagger:swagger-core:jar:1.5.21:compile
[INFO] | | | \- io.swagger:swagger-models:jar:1.5.21:compile
[INFO] | | | \- io.swagger:swagger-annotations:jar:1.5.21:compile
[INFO] | | +- io.swagger:swagger-compat-spec-parser:jar:1.0.39:compile
[INFO] | | | +- com.github.java-json-tools:json-schema-validator:jar:2.2.8:compile
[INFO] | | | | +- com.github.java-json-tools:json-schema-core:jar:1.2.8:compile
[INFO] | | | | | +- org.mozilla:rhino:jar:1.7R4:compile
View gist:448126795714e80f4c38b375dd675655
[INFO] +- io.vertx:vertx-web-api-contract:jar:3.6.0-SNAPSHOT:compile (optional)
[INFO] | +- com.networknt:json-schema-validator:jar:0.1.23:compile (optional)
[INFO] | +- io.swagger.parser.v3:swagger-parser:jar:2.0.5:compile (optional)
[INFO] | | +- io.swagger.parser.v3:swagger-parser-v2-converter:jar:2.0.5:compile (optional)
[INFO] | | | +- io.swagger:swagger-parser:jar:1.0.39:compile (optional)
[INFO] | | | | \- io.swagger:swagger-core:jar:1.5.21:compile (optional)
[INFO] | | | | \- io.swagger:swagger-models:jar:1.5.21:compile (optional)
[INFO] | | | | \- io.swagger:swagger-annotations:jar:1.5.21:compile (optional)
[INFO] | | | +- io.swagger:swagger-compat-spec-parser:jar:1.0.39:compile (optional)
[INFO] | | | | +- com.github.java-json-tools:json-schema-validator:jar:2.2.8:compile (optional)
You can’t perform that action at this time.