Skip to content

Instantly share code, notes, and snippets.

View Hc747's full-sized avatar
🤠
Waiting for builds to finish...

Harrison Cole Hc747

🤠
Waiting for builds to finish...
  • Australia
  • 19:50 (UTC +10:00)
View GitHub Profile
@Hc747
Hc747 / multiplexor.go
Last active May 11, 2021 05:49
HTTP Multiplexor in Go and Kotlin
package main
import (
"net/http"
"time"
"io/ioutil"
"fmt"
"net/url"
)
class DiscordRichPresenceUpdate(private val details: String?, private val state: String?, private val key: String?) {
fun encode(): PacketBuilder {
val buffer = PacketBuilder(PACKET_ID, PacketType.BYTE)
val builder = PacketBuilder()
var mask: Byte = 0
if (details != null) {
class DiscordRichPresenceUpdate(private val details: String?, private val state: String?, private val key: String?) {
fun encode(): PacketBuilder {
val buffer = PacketBuilder()
val builder = PacketBuilder(PACKET_ID, PacketType.BYTE)
var mask: Byte = 0
if (details != null) {
mask = mask xor DETAILS_MASK
interface Entity
class Player(val name: String) : Entity {
fun say(message: String) = println("$name: $message")
}
class NPC(val type: String) : Entity
interface Entity
class Player(val name: String) : Entity
class NPC(val type: String) : Entity
enum class EventKey {
INIT,
PROCESS,
FINISH
}
interface IndexedEntity<T : IndexedEntity<T>> {
var index: EntityIndexReference<T>?
}
class EntityIndexReference<T : IndexedEntity<T>> internal constructor(val container: EntityList<T>, val entity: T, val index: Int)
class EntityList<T : IndexedEntity<T>>(private val capacity: Int) : AbstractCollection<T>() {
interface IndexedEntity<T : IndexedEntity<T>> {
var index: EntityIndexReference<T>?
}
class EntityIndexReference<T : IndexedEntity<T>> internal constructor(val container: EntityList<T>, val entity: T, val index: Int)
class EntityList<T : IndexedEntity<T>>(private val capacity: Int) : AbstractCollection<T>() {
package your.package.here;
/**
* @author Harrison, Alias: Hc747, Contact: harrisoncole05@gmail.com
* @version 1.0
* @since 12/3/18
*/
public class LinkedList<T> {
private Node head;