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
  • 03:15 (UTC +10:00)
View GitHub Profile
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;
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>() {
interface Entity
class Player(val name: String) : Entity
class NPC(val type: String) : Entity
enum class EventKey {
INIT,
PROCESS,
FINISH
}
interface Entity
class Player(val name: String) : Entity {
fun say(message: String) = println("$name: $message")
}
class NPC(val type: String) : Entity
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
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) {
@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"
)
export default class User {
constructor(username, email, password_hash, session_token) {
this.username = username;
this.email = email;
this.password_hash = password_hash;
this.session_token = session_token;
}
isAuthenticated() {
const express = require('express');
const router = express.Router();
//TODO: put models into own package
class IdentifiableModel {
//TODO: proptypes or typescript
constructor(id) {
this.id = id;
}