Skip to content
Chen

Command Palette

Search for a command to run...

Code Snippet

Embed Dependenices without any plugin in Gradle
The simplest way to embed dependencies in Gradle without any plugin
groovykotlin
Expand variables like {version} in resource file for Gradle
Transform resource file with variables like {version} to real value
groovykotlin
Add source jar with Gradle
generate a sources.jar while project build
groovy
Equivalent JavaScript Class in Function
Classes are a template for creating objects, built on prototypes. A JavaScript class is a type of function. So you can convert a class to a function.
javascript
Use Collector to merge multiple JSON objects into one
Turn Stream<JsonObject> to single JsonObject
java
Transform string with Minecraft color code to HTML
Generate pure html without css class
typescript
Read VarInt (variable integer) from DataStream
Variable-width integers, or varints, are at the core of the wire format. They allow encoding unsigned 64-bit integers using anywhere between one and ten bytes, with small values using fewer bytes. Each byte in the varint has a continuation bit that indicates if the byte that follows it is part of the varint.
java
Get all classes under a package
Use guava to get all classes under a package without loading it
java
Using CompletableFuture in Kotlinx.Coroutine
Await the result of CompletableFuture in Kotlinx.Coroutine
kotlin
Print stack trace of an exception in Kotlinx.Coroutine
By default, Kotlinx.Coroutine will not print stack trace of an exception. This snippet will print stack trace of an exception.
kotlin
Calculate MD5 of a file in Rust
An example of using md5 and file to calculate MD5 of a file in stream
rust
Generate random string or bytes in Rust
An example of using create::rand and Iterator to generate random string or bytes
rust