Skip to content

Instantly share code, notes, and snippets.

View Jire's full-sized avatar
🇧🇷
of the jungle

Jire Jire

🇧🇷
of the jungle
View GitHub Profile
package org.jire
import java.util.*
abstract class DynamicBody<T>(val parent: DynamicBody<*>?, val body: T.() -> Any) {
protected val map = HashMap<String, Any>()
infix fun String.to(value: Any): Any {
map[this] = value
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
import javax.swing.*;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.io.*;
import java.lang.reflect.Method;
class Ternary<T>(val condition: Boolean, val whenTrue: T) {
operator fun minus(whenFalse: T) = if (condition) whenTrue else whenFalse
}
operator fun <T> Boolean.plus(whenTrue: T) = Ternary(this, whenTrue)
Feb 04, 2016 4:45:57 AM org.rse.Server main
INFO: IceyScape has been successfully started in 2657ms!
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 520,517 milliseconds ago. The last packet sent successfully to the server was 18 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
@Jire
Jire / Stringa.kt
Last active February 16, 2016 21:50
@file:JvmName("Stringa")
package org.jire.stringa
import java.util.*
private val intToString = HashMap<Int, String>(8192)
private val arrayToString = HashMap<Int, Int>(8192)
fun String.stringa() {
import java.util.*
class JireMap<K, V>(val capacity: Int = 16) : Iterable<JireMap.Entry<K, V>> {
data class Entry<K, V>(val key: K, val value: V, var next: Entry<K, V>? = null)
private var table = arrayOfNulls<Entry<K, V>>(capacity)
fun K.hash() = Math.abs(hashCode()) % table.size
Game 1
JLRE: trump 2016
JLRE: trump wants every game to be a win
JLRE: darius go top
JLRE: idc
JLRE: with donald trump ganks won't be possible since those are illegal immigration to other lanes
JLRE: ekko you're black, you're getting deported
JLRE: ur mom's an african lad
JLRE: ggwp
object StringCache {
private val map = HashMap<Int, String>(1024)
operator fun get(bytes: ByteArray, hash: Int = bytes.hashCode()): String {
if (map.containsKey(hash)) return map[hash]!!
val string = String(bytes).intern()
map[hash] = string
return string
}
val version = 0xFF - byte.usin
val release = short.usin
val highDetail = boolean
for (i in 0..9) int // CRCs
val blockLength = byte.usin
val blockID = byte.usin
for (i in 0..4) int // ISAAC keys
val group = NioEventLoopGroup()
val initializer = object : ChannelInitializer<SocketChannel>() {
override fun initChannel(ch: SocketChannel) {
ch.pipeline().addFirst(object : ChannelInboundHandlerAdapter() {
override fun channelRegistered(ctx: ChannelHandlerContext) {
ctx.writeAndFlush(buf)
println("Sent.")
}
})
}