This file contains 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 Wtf | |
// Primitives | |
operator fun Int.plus(that: String) = "$this$that" | |
operator fun String.plus(that: Int) = "$this$that" | |
This file contains 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
// ==UserScript== | |
// @name FalkeynScript | |
// @match * | |
// ==/UserScript== | |
/* jshint multistr: true */ | |
(function() { | |
var css = '\ | |
<style>\ |
This file contains 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
/** | |
* Database.kt | |
*/ | |
import com.rethinkdb.RethinkDB | |
import com.rethinkdb.gen.ast.ReqlExpr | |
import com.rethinkdb.net.Connection | |
import com.rethinkdb.net.ConnectionInstance | |
object Database { | |
private lateinit var db: String |
This file contains 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
fun max<T : Any>(list: List<T>, weight: (T) -> Int): T? { | |
return when (list.size()) { | |
0 -> null | |
1 -> list.first() | |
else -> list.reduce({ a, b -> if (weight(a) > weight(b)) a else b }) | |
} | |
} | |
fun main(args: Array<String>) { | |
println( max(listOf("a", "bcd", "ef"), { it.length() }) ) |
NewerOlder