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
use std::io::Read; | |
use byteorder::{ByteOrder, ReadBytesExt}; | |
/// a utility class for handling little-endian numbers, which the 80x86 world is | |
/// replete with. The methods are all static, and input/output is from/to byte | |
/// arrays, or from InputStreams. | |
/// Source: https://github.com/apache/poi/blob/trunk/poi/src/main/java/org/apache/poi/util/LittleEndian.java | |
pub struct LittleEndian; |
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
use std::collections::HashMap; | |
use super::{header_block_constants::HeaderBlockConstants, little_endian::LittleEndian}; | |
/// The file magic number, i.e. the file identification based on the first bytes of the file | |
/// Source: https://github.com/apache/poi/blob/trunk/poi/src/main/java/org/apache/poi/poifs/filesystem/FileMagic.java | |
#[derive(Debug, PartialEq, Eq, Hash)] | |
struct Magic(Vec<Vec<u8>>); | |
#[derive(Debug, PartialEq)] |
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
// https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=65bf7ea271639b39204804a5351a96a3 | |
//! ## Task Description | |
//! | |
//! The goal is to develop a backend service for shortening URLs using CQRS | |
//! (Command Query Responsibility Segregation) and ES (Event Sourcing) | |
//! approaches. The service should support the following features: | |
//! | |
//! ## Functional Requirements | |
//! |
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 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 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 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 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
// 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 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 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 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 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 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 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 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
/** | |
* 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. | |
* ``` |
NewerOlder