This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") | |
} | |
}) | |
} |