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
import scala.math.Ordering.Implicits.infixOrderingOps | |
/** simple interval [min, max) (or >= min if max is empty) */ | |
final class Interval[A](val min: A, val max: Option[A])(implicit num: Numeric[A]) extends Serializable { | |
/** if max nonEmpty, then max > min */ | |
require(testRightBound(max, min)) | |
def in(value: A): Boolean = | |
value >= min && testRightBound(max, value) |
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 util | |
import doobie.LogHandler | |
import doobie.util.log.{ExecFailure, ProcessingFailure, Success} | |
import org.slf4j.LoggerFactory | |
object Slf4jLogger { | |
val slf4jLogHandler: LogHandler = { | |
val logger = LoggerFactory.getLogger(getClass.getName) |
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
// RHO, CompileRoutesSuite | |
sealed trait Foo extends Product with Serializable | |
case class Bar(i: Int) extends Foo | |
case class Baz(v: UUID) extends Foo | |
test("A CompileService should make routes from a collection of RhoRoutes 2") { | |
import org.http4s.rho.bits.StringParser.booleanParser | |
import org.http4s.rho.bits.StringParser.uuidParser | |
import scala.reflect.runtime.universe.TypeTag |
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
import org.apache.flink.connector.jdbc.catalog.AbstractJdbcCatalog; | |
import org.apache.flink.connector.jdbc.table.JdbcConnectorOptions; | |
import org.apache.flink.connector.jdbc.table.JdbcDynamicTableFactory; | |
import org.apache.flink.table.api.DataTypes; | |
import org.apache.flink.table.api.Schema; | |
import org.apache.flink.table.api.ValidationException; | |
import org.apache.flink.table.api.constraints.UniqueConstraint; | |
import org.apache.flink.table.catalog.CatalogBaseTable; | |
import org.apache.flink.table.catalog.CatalogDatabase; | |
import org.apache.flink.table.catalog.CatalogDatabaseImpl; |
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
import org.apache.flink.util.StringUtils; | |
import java.util.Objects; | |
import static org.apache.flink.util.Preconditions.checkArgument; | |
public class MySqlTablePath { | |
private static final String DEFAULT_SCHEMA_NAME = "public"; | |
private final String schemaName; | |
private final String tableName; |
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 benchmarks | |
import org.openjdk.jmh.annotations._ | |
import scala.util.Random | |
import java.util.concurrent.TimeUnit | |
import scala.annotation.tailrec | |
/* | |
[info] Benchmark (size) Mode Cnt Score Error Units |
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
/** | |
* Flood Fill | |
* Given a matrix a containing numbers that represents a | |
* labyrinth with empty space and walls, as follows: | |
* 0 is empty space, 1 is a wall, and 2 is water. | |
* | |
* Write a program that fills the labyrinth with water starting | |
* from a given position given by coordinates x and y, | |
* The top-left coordinate of the matrix is 0,0. | |
* ``` |
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
/** | |
* Join list of lists by order of elements | |
* val a = List(3, 5, 6) | |
* val b = List(1, 2, 7, 8) | |
* val expected = List(3, 1, 2, 5, 6, 7, 8) | |
* | |
* @param lists list of lists of elements | |
* @return list of elements | |
*/ | |
def join[A](lists: List[List[A]]): List[A] = { |
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
import java.net.InetAddress | |
import java.nio.ByteBuffer | |
object InetUtils { | |
private[this] val Radix = 16 | |
// Fast Hex converters | |
private[this] val HexChars: Array[Char] = "0123456789ABCDEF".toCharArray |
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
import scala.xml._ | |
import java.util.Date | |
import java.lang.ThreadLocal | |
import java.text.SimpleDateFormat | |
import scala.collection.immutable._ | |
/** | |
* Simple XmlTv format parser | |
* http://wiki.xmltv.org/index.php/XMLTVFormat | |
*/ |
NewerOlder