code stringlengths 5 1M | repo_name stringlengths 5 109 | path stringlengths 6 208 | language stringclasses 1
value | license stringclasses 15
values | size int64 5 1M |
|---|---|---|---|---|---|
import tw.com.ehanlin.mde.MongoEmbedder
class Example1 extends ReadmeExampleTest { def is = s2"""
Example1 $example1
"""
def example1 = {
val dsl =
"""
|@find <db=user coll=user query={ height : { $gte : 215 } }>
|[
| @count (db=user coll=user query={ height : { $gte : 200 } , ... | eHanlin/mongodb-dbobject-embedder | src/test/scala/Example1.scala | Scala | mit | 1,851 |
package lila.analyse
import org.joda.time._
import lila.db.dsl._
import lila.user.User
final class RequesterApi(coll: Coll) {
private val formatter = format.DateTimeFormat.forPattern("YYYY-MM-dd")
private def today = formatter.print(DateTime.now)
def save(analysis: Analysis): Funit = coll.update(
$id(an... | clarkerubber/lila | modules/analyse/src/main/RequesterApi.scala | Scala | agpl-3.0 | 565 |
/*
* Copyright (C) 2016-2019 Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.internal.broker.kafka
import java.net.URI
import akka.Done
import akka.actor.{ Actor, ActorLogging, Props, Status }
import akka.kafka.ConsumerMessage.CommittableOffset
import akka.kafka.scaladsl.{ Committer, Cons... | rstento/lagom | service/core/kafka/client/src/main/scala/com/lightbend/lagom/internal/broker/kafka/KafkaSubscriberActor.scala | Scala | apache-2.0 | 5,697 |
package me.jeffmay.util.akka
import java.util.concurrent.ThreadFactory
import akka.actor.{LightArrayRevolverScheduler, Scheduler}
import akka.event.{NoLogging, LoggingAdapter}
import com.typesafe.config.{ConfigFactory, Config}
/**
* Creates an Akka [[Scheduler]] with default arguments.
*/
object TestAkkaSchedule... | AudaxHealthInc/neo4j-scala-client | ws-test-util/src/main/scala/me/jeffmay/util/akka/TestAkkaScheduler.scala | Scala | apache-2.0 | 603 |
/*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Fou... | TiarkRompf/lancet | src/main/scala/generated/scala/DoubleStreamRow.scala | Scala | agpl-3.0 | 1,504 |
/***********************************************************************
* Copyright (c) 2013-2022 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... | locationtech/geomesa | geomesa-utils/src/test/scala/org/locationtech/geomesa/utils/stats/StatTestHelper.scala | Scala | apache-2.0 | 1,874 |
/*
* Copyright 2021 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | hmrc/play-ui | src/main/twirl/uk/gov/hmrc/play/views/formatting/Money.scala | Scala | apache-2.0 | 902 |
package de.tu_berlin.impro3.scala.spatio_temporal_dynamics.model
import de.tu_berlin.impro3.scala.spatio_temporal_dynamics._
import geo.Location
/** Representation of a HashTag occurrence with timestamp and [[Location]]. */
case class HashTag(text: String, time: Long, location: Location) {
def zone = location.zone
... | joroKr21/spatio-temporal-dynamics | impro3-ws14-scala/src/main/scala/de/tu_berlin/impro3/scala/spatio_temporal_dynamics/model/HashTag.scala | Scala | apache-2.0 | 471 |
class Foo {
import collection.immutable.Map
val m : <ref>Map
} | ilinum/intellij-scala | testdata/resolve/class/classLevelImport/classLevelImport.scala | Scala | apache-2.0 | 66 |
package score.discord.canti.jdamocks
import java.util
import java.util.Collections
import net.dv8tion.jda.api.JDA
import net.dv8tion.jda.api.entities.{
Message, MessageActivity, MessageChannel, MessageEmbed, MessageSticker, User
}
import net.dv8tion.jda.internal.entities.AbstractMessage
import score.discord.canti.S... | ScoreUnder/canti-bot | src/test/scala/score/discord/canti/jdamocks/FakeMessage.scala | Scala | agpl-3.0 | 1,203 |
#!/usr/bin/env scala
// Copyright 2017 Marko Dimjašević
//
// This file is part of jdoop-wrapper.
//
// jdoop-wrapper is free software: you can redistribute it and/or modify it
// under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// Licens... | soarlab/jdoop-wrapper | sf110/zip-benchmarks.scala | Scala | agpl-3.0 | 2,950 |
/*
* Copyright 2016 Miroslav Janíček
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | kroepke/luna | luna-tests/src/test/scala/org/classdump/luna/test/fragments/DebugLibFragments.scala | Scala | apache-2.0 | 11,977 |
package models
import java.util.Date
case class Comment(_id: String,
content: String,
publishingDate: Date,
ipAddress: String,
author: String,
postKey: String,
like: Long,
visible: Boo... | cyrilsx/blog_example_play2 | app/models/comment.scala | Scala | apache-2.0 | 515 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | goldmedal/spark | sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/text/TextSuite.scala | Scala | apache-2.0 | 9,009 |
package main.scala
/**
* Object for logging activation levels
*/
import java.io.FileWriter
class Logger(val fileName : String) {
var ticks = 0
val file = new FileWriter(fileName)
def log(str : String) {
file.write(str + "\\n")
}
} | dbigelow/activation_network | src/main/scala/Logger.scala | Scala | bsd-2-clause | 247 |
/*
* MutableMovie.scala
* A probabilistic relational model example with multi-valued attributes.
*
* Created By: Avi Pfeffer (apfeffer@cra.com)
* Creation Date: Jan 1, 2009
*
* Copyright 2013 Avrom J. Pfeffer and Charles River Analytics, Inc.
* See http://www.cra.com or email figaro@cra.com for informati... | agarbuno/figaro | FigaroExamples/src/main/scala/com/cra/figaro/example/MutableMovie.scala | Scala | bsd-3-clause | 5,624 |
/***********************************************************************
* Copyright (c) 2013-2018 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... | boundlessgeo/geomesa | geomesa-index-api/src/main/scala/org/locationtech/geomesa/index/index/z2/XZ2IndexKeySpace.scala | Scala | apache-2.0 | 3,223 |
/*
* Copyright 2015 the original author or authors.
* @https://github.com/scouter-project/scouter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/... | scouter-project/scouter | scouter.server/src/main/scala/scouter/server/core/cache/StatusCache.scala | Scala | apache-2.0 | 1,974 |
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/... | som-snytt/scala-xml | src/main/scala/scala/xml/PrettyPrinter.scala | Scala | bsd-3-clause | 7,895 |
package com.azavea.opentransit.indicators
import com.azavea.gtfs._
import com.azavea.opentransit.testkit._
import com.azavea.opentransit.indicators.calculators._
import com.github.nscala_time.time.Imports._
import com.typesafe.config.{ConfigFactory,Config}
import org.scalatest._
import org.scalatest.OptionValues._
... | flibbertigibbet/open-transit-indicators | scala/opentransit-test/src/test/scala/com/azavea/opentransit/indicators/OnTimePerformanceSpec.scala | Scala | gpl-3.0 | 875 |
package shared
import java.util.Date
package foo {
case class Foo(
int: Int = 1,
string: String = "foo",
date: Date = new Date,
listInt: List[Int] = List(1, 2, 3),
listString: List[String] = List("A", "B", "C"),
listObj: List[KV] = List(KV("a", "1"), KV("b", "2"))
)
case class KV(k: Strin... | gurghet/rota-scalajs | example-shared/src/main/scala/shared/foo.scala | Scala | mit | 340 |
package a19.step10
trait 个十位 {
type Next[T] <: 个十位
}
class M_0 extends 个十位 {
override type Next[T] = M_1[T]
}
class M_1[T1] extends 个十位 {
type _1_th = T1
override type Next[T] = M_2[T1, T]
}
class M_2[T1, T2] extends 个十位 {
type _1_th = T1
type _2_th = T2
override type Next[T] = P_3_Step_0[T1, T2, S_... | djx314/ubw | a19-一二三/src/main/scala/a19/step10/三进制.scala | Scala | bsd-3-clause | 5,858 |
package failurewall.retry
import java.util.concurrent.ThreadLocalRandom
import scala.concurrent.duration.FiniteDuration
/**
* A strategy to compute a backoff.
*/
trait BackoffStrategy {
/**
* Calculates the next backoff.
* @param trialTimes number of times of failed execution. 1 if it is the first retrial
... | failurewall/failurewall | failurewall-core/src/main/scala/failurewall/retry/BackoffStrategy.scala | Scala | apache-2.0 | 3,236 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | ron8hu/spark | resource-managers/yarn/src/main/scala/org/apache/spark/scheduler/cluster/YarnClientSchedulerBackend.scala | Scala | apache-2.0 | 6,212 |
// package controllers
// import play.api._
// import play.api.mvc._
// import navigator._
// object Todos extends Controller with PlayResources[Int] {
// def index = Action { Ok("Todos.index => %s" format Routing.todos.index()) }
// def `new` = Action { Ok("Todos.new => %s" format Routing.todos.`new`()) }
// d... | teamon/play-navigator | src/test/scala/play/navigator/temp/Todos.scala | Scala | mit | 811 |
package dst.amqp
import scala.util.Try
import com.rabbitmq.client.ConnectionFactory
class Connection(connectionFactory: ConnectionFactory = new ConnectionFactory()) {
def this(
hostName: Option[String] = None,
portNumber: Option[Int] = None,
virtualHost: Option[String] = None,
userName... | Destination/lib-dst-amqp | src/main/scala/Connection.scala | Scala | mit | 997 |
package edu.knowitall.collection.immutable.graph.pattern
import edu.knowitall.common.enrich.Iterables
import edu.knowitall.collection.immutable.graph.{ Graph, DirectedEdge, Bipath }
/**
* Represents a pattern with which graphs can be searched.
* A pattern will start and end with a node matcher, and every
* matcher... | knowitall/common-scala | src/main/scala/edu/knowitall/collection/immutable/graph/pattern/Pattern.scala | Scala | bsd-3-clause | 3,921 |
package com.sksamuel.avro4s.record.encoder
import com.sksamuel.avro4s.{AvroFixed, AvroSchema, DefaultNamingStrategy, Encoder}
import org.apache.avro.generic.{GenericFixed, GenericRecord}
import org.scalatest.{FunSuite, Matchers}
@AvroFixed(8)
case class QuarterSHA256(bytes: Array[Byte]) extends AnyVal
case class Fix... | 51zero/avro4s | avro4s-core/src/test/scala/com/sksamuel/avro4s/record/encoder/FixedEncoderTest.scala | Scala | mit | 1,730 |
/**
* Copyright (C) 2015 Orbeon, Inc.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* This program i... | joansmith/orbeon-forms | src/main/scala/org/orbeon/oxf/portlet/liferay/FormRunnerAuthFilter.scala | Scala | lgpl-2.1 | 4,791 |
/*
* Copyright 2010-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... | pbrant/framework | persistence/proto/src/main/scala/net/liftweb/proto/ProtoRules.scala | Scala | apache-2.0 | 1,186 |
package info.rkuhn.linkchecker
import akka.actor.Actor
import akka.actor.ActorRef
import akka.actor.Props
import akka.actor.Terminated
object Receptionist {
private case class Job(client: ActorRef, url: String)
case class Get(url: String)
case class Result(url: String, links: Set[String])
case class Failed(ur... | mitochon/hexercise | src/mooc/reactive/week5-4/src/main/scala/info/rkuhn/linkchecker/Receptionist.scala | Scala | mit | 1,289 |
class C {
private type T = E
private type Tok = D
private val p: C = new C
def f1(x: T): Unit = () // error
def f1(x: Tok): Unit = () // ok
def f2(x: p.D): Unit = () // error
val v1: T = ??? // error
val v2: p.D = ??? // error
type U1[X <: T] // error
type U2 = T // error
private class E {
... | densh/dotty | tests/neg/i997.scala | Scala | bsd-3-clause | 844 |
package provingground.fol
import provingground.XmlParse._
import provingground.fol.ParseProse._
/** Parses the sentence in a given xml file */
object Test extends App {
private val filename = if (args.isEmpty) "example.xml" else args(0)
private val tree = proseTree(filename)
println(tree)
val formula = to... | siddhartha-gadgil/ProvingGround | digressions/src/main/scala/provingground/fol/Test.scala | Scala | mit | 391 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | darionyaphet/spark | sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/CustomShuffledRowRDD.scala | Scala | apache-2.0 | 4,683 |
package com.socrata.datacoordinator.truth.metadata.sql
import com.rojoma.json.v3.ast.JObject
import com.rojoma.json.v3.util.JsonUtil
import com.socrata.datacoordinator.truth.metadata.{ColumnInfo, CopyInfo}
import com.rojoma.simplearm.v2.using
trait IndexControl[CT] { this: BasePostgresDatasetMapWriter[CT] =>
priva... | socrata-platform/data-coordinator | coordinatorlib/src/main/scala/com/socrata/datacoordinator/truth/metadata/sql/IndexControl.scala | Scala | apache-2.0 | 1,800 |
object Main extends App {
def thread(body: =>Unit): Thread = {
val t = new Thread {
override def run() = body
}
t.start
t
}
} | DagF/tdt4165_progspraak_project_h15 | part2-exercise/src/main/scala/Main.scala | Scala | mit | 168 |
/***********************************************************************
* Copyright (c) 2013-2018 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... | jahhulbert-ccri/geomesa | geomesa-accumulo/geomesa-accumulo-datastore/src/main/scala/org/locationtech/geomesa/accumulo/index/legacy/z2/Z2IndexV1.scala | Scala | apache-2.0 | 4,054 |
/*
* Copyright 2017 helloscala.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... | helloscala/helloscala | hs-akka-http/src/main/scala/helloscala/http/server/HSAkkaHttpServer.scala | Scala | apache-2.0 | 7,778 |
package com.github.cuzfrog.webdriver
import java.io.{FileNotFoundException, InputStream}
/**
* Created by cuz on 1/23/17.
*/
private object SourceReader {
/**
* Given a resource path, read file on that path and return source code.<br>
* if name is not specified, return empty String.
*
* @param n... | cuzfrog/WebDriverServ | client/src/main/scala/com/github/cuzfrog/webdriver/SourceReader.scala | Scala | apache-2.0 | 967 |
package com.github.opengrabeso.mixtio.common.css
import io.udash.css._
import scala.language.postfixOps
object SelectPageStyles extends CssBase {
import dsl._
val textCenter: CssStyle = style(
textAlign.center
)
val infoIcon: CssStyle = style(
fontSize(1 rem)
)
val containerBorder = mixin(
... | OndrejSpanel/Stravamat | shared-js/src/main/scala/com/github/opengrabeso/mixtio/common/css/SelectPageStyles.scala | Scala | gpl-2.0 | 1,333 |
package controllers
import play.api._
import play.api.mvc._
import play.api.Play.current
import play.api.libs.concurrent._
import play.api.libs.concurrent.Execution.Implicits._
import scala.concurrent.duration._
import scala.concurrent._
//import akka.actor.{Actor,ActorRef,Props}
// Necessary for `actor ? messag... | MesoamericaAppsHackatonPanama2013/TraficoUrbano | app/controllers/Application.scala | Scala | apache-2.0 | 2,441 |
package im.actor.server.mtproto.codecs
import scodec._
import scodec.bits.BitVector
class DiscriminatedErrorCodec[T](codecName: String) extends Codec[T] {
def sizeBound = SizeBound.unknown
def encode(a: T) = Attempt.failure(Err(s"$codecName.header is unknown for ${a.getClass.getCanonicalName}"))
def decode(bu... | boneyao/actor-platform | actor-server/actor-codecs/src/main/scala/im/actor/server/mtproto/codecs/DiscriminatedErrorCodec.scala | Scala | mit | 526 |
package us.feliscat.text.normalizer.en
import us.feliscat.m17n.English
import us.feliscat.text.StringOption
import us.feliscat.text.normalizer.EscapeObject
/**
* @author K.Sakamoto
* Created on 2016/08/07
*/
object EnglishEscapeCharacter extends EscapeObject(StringOption("escape_character.txt")) with En... | ktr-skmt/FelisCatusZero-multilingual | libraries/src/main/scala/us/feliscat/text/normalizer/en/EnglishEscapeCharacter.scala | Scala | apache-2.0 | 326 |
package com.git.huanghaifeng.spark.basic
import org.apache.spark.SparkContext
object BasicCombineByKey {
def main(args: Array[String]) {
val master = args.length match {
case x: Int if x > 0 => args(0)
case _ => "local"
}
val sc = new SparkContext(ma... | prucehuang/quickly-start-spark | src/main/scala/com/git/huanghaifeng/spark/basic/BasicCombineByKey.scala | Scala | apache-2.0 | 1,001 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | bowenli86/flink | flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/plan/rules/dataSet/DataSetIntersectRule.scala | Scala | apache-2.0 | 2,014 |
/*
* Copyright 2017 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | pncampbell/ct-calculations | src/main/scala/uk/gov/hmrc/ct/computations/CP87.scala | Scala | apache-2.0 | 926 |
/*
* Copyright 2014 Commonwealth Computer Research, Inc.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicabl... | jwkessi/geomesa | geomesa-plugin/src/test/scala/org/locationtech/geomesa/plugin/wfs/output/BinaryViewerOutputFormatTest.scala | Scala | apache-2.0 | 1,120 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | ueshin/apache-spark | sql/core/src/main/scala/org/apache/spark/sql/execution/SubqueryBroadcastExec.scala | Scala | apache-2.0 | 5,409 |
/*
* =========================================================================================
* Copyright © 2017 Workday, Inc.
* Copyright © 2013-2017 the kamon project <http://kamon.io/>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the... | Workday/prometheus-akka | src/main/scala/com/workday/prometheus/akka/ActorGroupMetrics.scala | Scala | apache-2.0 | 2,234 |
package com.qmee.sprayherokuexample
import org.specs2.mutable.Specification
import spray.testkit.Specs2RouteTest
import spray.http._
import spray.json._
import spray.routing.authentication._
import HttpHeaders._
import StatusCodes._
import akka.actor.{ActorSystem,Props,Actor}
import akka.testkit.TestActorRef
import ak... | juanpanore/spray-heroku-example | src/test/scala/MyServiceSpec.scala | Scala | apache-2.0 | 2,562 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | eBay/Eagle | eagle-core/eagle-data-process/eagle-stream-process-api/src/main/scala/org/apache/eagle/datastream/StreamAppDSL.scala | Scala | apache-2.0 | 3,957 |
package net.scalytica.symbiotic.test.repositories
import akka.actor.ActorSystem
import akka.stream.Materializer
import net.scalytica.symbiotic.api.repository.IndexDataRepository
import net.scalytica.symbiotic.api.types.SymbioticContext
class TestIndexDataRepository extends IndexDataRepository {
override def streamF... | kpmeen/symbiotic | symbiotic-shared/src/test/scala/net/scalytica/symbiotic/test/repositories/TestIndexDataRepository.scala | Scala | apache-2.0 | 553 |
/**
* Copyright 2015, deepsense.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... | deepsense-io/seahorse-workflow-executor | commons/src/main/scala/io/deepsense/commons/auth/usercontext/TokenTranslator.scala | Scala | apache-2.0 | 1,418 |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may... | cran/rkafkajars | java/kafka/server/KafkaServerStartable.scala | Scala | apache-2.0 | 1,887 |
package net.nomadicalien.ch2
/**
* Calculating interest—a polymorphic version
*/
object Listing2_2 {
import Listing2_1.Amount
import Listing2_1.DateRange
import Listing2_1.InterestRate
import Listing2_1.balanceInRange
import Listing2_1.MonthlyAverageBalance
sealed trait Account {
def number: Strin... | BusyByte/functional-n-reactive-domain-modeling | chapter2/src/main/scala/Listing2_2.scala | Scala | apache-2.0 | 1,346 |
package geotrellis.test.multiband.hbase
import geotrellis.config.Dataset
import geotrellis.raster.MultibandTile
import geotrellis.spark._
import geotrellis.spark.io._
import geotrellis.test.HBaseTest
import geotrellis.test.multiband.load.S3Load
import geotrellis.util.S3Support
import geotrellis.vector.ProjectedExtent
... | geotrellis/geotrellis-integration-tests-tool | src/main/scala/geotrellis/test/multiband/hbase/S3IngestTest.scala | Scala | apache-2.0 | 657 |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may... | archieco/kafka | project/build/KafkaProject.scala | Scala | apache-2.0 | 10,121 |
package uk.gov.gds.ier.transaction.ordinary.name
import uk.gov.gds.ier.test._
import uk.gov.gds.ier.model.Name
import uk.gov.gds.ier.model.PreviousName
import uk.gov.gds.ier.transaction.ordinary.InprogressOrdinary
class NameMustacheTest
extends MustacheTestSuite
with NameForms
with NameMustache {
it should "... | michaeldfallen/ier-frontend | test/uk/gov/gds/ier/transaction/ordinary/name/NameMustacheTest.scala | Scala | mit | 5,006 |
package com.datastax.spark.connector.util
import com.datastax.spark.connector._
import com.datastax.spark.connector.testkit.AbstractSpec
import com.datastax.spark.connector.util.JavaApiHelper
import org.apache.commons.lang3.SerializationUtils
import scala.reflect.runtime.universe._
class AnyObjectFactoryTest extends... | datastax/spark-cassandra-connector | connector/src/test/scala/com/datastax/spark/connector/util/AnyObjectFactoryTest.scala | Scala | apache-2.0 | 9,505 |
package x7c1.linen.database.mixin
import android.database.Cursor
import x7c1.linen.database.struct.{ChannelRecord, ChannelStatusRecord, HasAccountId}
import x7c1.wheat.macros.database.Query.SqlBuilder
import x7c1.wheat.macros.database.{Query, TypedCursor, TypedFields}
import x7c1.wheat.modern.database.selector.RecordR... | x7c1/Linen | linen-repository/src/main/scala/x7c1/linen/database/mixin/SubscribedChannelRecord.scala | Scala | mit | 1,412 |
package breeze.linalg
import org.scalatest.funsuite.AnyFunSuite
class whereTest extends AnyFunSuite {
test("DenseVector") {
assert(where(DenseVector(1, 2, 0, 4, 5, 0)) === IndexedSeq(0, 1, 3, 4))
}
test("SparseVector") {
assert(where(SparseVector(100)(0 -> 1, 1 -> 2, 3 -> 4, 4 -> 5)) === IndexedSeq(0, ... | scalanlp/breeze | math/src/test/scala/breeze/linalg/whereTest.scala | Scala | apache-2.0 | 896 |
package chat.tox.antox.toxme
object ToxMeName {
def fromString(toxMeName: String, useToxMe: Boolean): ToxMeName = {
val split = toxMeName.split("@")
val domain =
if (useToxMe) {
val domain = if (split.length == 1) ToxMe.DEFAULT_TOXME_DOMAIN else split(1)
Some(domain)
} else None
... | wiiam/Antox | app/src/main/scala/chat/tox/antox/toxme/ToxMeName.scala | Scala | gpl-3.0 | 530 |
package com.shorrockin.cascal.session
import org.apache.cassandra.thrift.{SliceRange, SlicePredicate}
import com.shorrockin.cascal.utils.Conversions
/**
* a predicate defines a function that is applied to a result set to limit
* the results returned.
*
* @author Chris Shorrock
*/
trait Predicate {
... | shorrockin/cascal | src/main/scala/com/shorrockin/cascal/session/Predicate.scala | Scala | apache-2.0 | 2,079 |
package com.gilt.gfc.guava
import com.google.common.base.{Predicate => GPredicate}
import org.scalatest.{FunSpec, Matchers}
class PredicateTest extends FunSpec with Matchers {
describe("Predicate Functions") {
val True: Predicate[String] = Predicate.alwaysTrue
val False: Predicate[String] = Predicate.alway... | gheine/gfc-guava | src/test/scala/com/gilt/gfc/guava/PredicateTest.scala | Scala | apache-2.0 | 3,219 |
package com.twitter.finagle.memcached.protocol.text
import com.twitter.finagle.memcached.protocol.ClientError
import com.twitter.finagle.memcached.util.ChannelBufferUtils._
import com.twitter.io.Charsets
import org.jboss.netty.buffer.{ChannelBuffer, ChannelBufferIndexFinder, ChannelBuffers}
import org.jboss.netty.chan... | suls/finagle | finagle-memcached/src/main/scala/com/twitter/finagle/memcached/protocol/text/AbstractDecoder.scala | Scala | apache-2.0 | 2,806 |
/*
* Copyright 2017 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | pncampbell/ct-calculations | src/main/scala/uk/gov/hmrc/ct/accounts/frs10x/boxes/ACQ8999.scala | Scala | apache-2.0 | 821 |
/*
* Copyright 2016 by Alex Dupre
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in... | eed3si9n/gigahorse | asynchttpclient/src/main/scala/gigahorse/support/asynchttpclient/WebSocketListener.scala | Scala | apache-2.0 | 3,065 |
package org.randi3.web.snippet
import org.randi3.web.util.CurrentTrial
import scala.xml._
import scala.xml.Group
import scala.xml.NodeSeq
import scala.xml.Text
import net.liftweb.http.S
import net.liftweb.util.Helpers._
import xml.{Text, NodeSeq}
import net.liftweb.util._
import net.liftweb._
import net.liftweb.common... | dschrimpf/randi3-web | src/main/scala/org/randi3/web/snippet/TrialGeneralInformationSnippet.scala | Scala | gpl-3.0 | 6,000 |
/*
* Copyright (C) 2015 Red Bull Media House GmbH <http://www.redbullmediahouse.com> - all rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/li... | seakayone/akka-eventuate-scala | src/main/scala/sample/eventuate/OrderManager.scala | Scala | apache-2.0 | 3,157 |
package org.eso.ias.utils.test
import ch.qos.logback.classic.Level
import org.eso.ias.logging.IASLogger
class ScalaLoggerTest {
/**
* Produces the logs
*
* @param alsoDebug if true emits DEBUG logs too
*/
def produceLogs(alsoDebug: Boolean) {
ScalaLoggerTest.logger.info("Generating logs")
... | IntegratedAlarmSystem-Group/ias | Utils/src/test/scala/org/eso/ias/utils/test/ScalaLoggerTest.scala | Scala | lgpl-3.0 | 1,010 |
package com.sksamuel.elastic4s.fields.builders
import com.sksamuel.elastic4s.fields.{ConstantKeywordField, DateField}
import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory}
object ConstantKeywordFieldBuilderFn {
def build(field: ConstantKeywordField): XContentBuilder = {
val builder = XContentFa... | stringbean/elastic4s | elastic4s-core/src/main/scala/com/sksamuel/elastic4s/fields/builders/ConstantKeywordFieldBuilderFn.scala | Scala | apache-2.0 | 450 |
package com.twitter.util
import org.junit.runner.RunWith
import org.scalatest.WordSpec
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class LastWriteWinsQueueTest extends WordSpec {
"LastWriteWinsQueue" should {
val queue = new LastWriteWinsQueue[String]
"add & remove items" in {
... | folone/util | util-core/src/test/scala/com/twitter/util/LastWriteWinsQueueTest.scala | Scala | apache-2.0 | 681 |
/**
* Copyright 2010-2013 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | scalatest/scalatest-website | app/examples/FunSpecExamples.scala | Scala | apache-2.0 | 14,524 |
package org.scalatest
import org.scalatest.SharedHelpers.SilentReporter
import java.util.concurrent.ExecutorService
class TestConcurrentDistributor(execService: ExecutorService) extends tools.ConcurrentDistributor(Args(reporter = SilentReporter), execService) {
override def apply(suite: Suite, tracker: Tracker): Un... | scalatest/scalatest | jvm/common-test/src/main/scala/org/scalatest/TestConcurrentDistributor.scala | Scala | apache-2.0 | 408 |
package com.sksamuel.elastic4s.mappings
import com.sksamuel.elastic4s.IndexesAndType
import com.sksamuel.elastic4s.analyzers.Analyzer
import com.sksamuel.elastic4s.mappings.dynamictemplate.{DynamicMapping, DynamicTemplateDefinition}
trait MappingDefinitionLike {
def all: Option[Boolean]
def source: Option[Boolean... | aroundus-inc/elastic4s | elastic4s-core/src/main/scala/com/sksamuel/elastic4s/mappings/MappingDefinition.scala | Scala | apache-2.0 | 10,029 |
/**
* Magmanics Licensing. This web application allows for centralized control
* of client application activation, with optional configuration parameters
* to control licensable features, and storage of supplementary information
* about the client machine. Client applications may interface with this
* central serv... | manicmonkey/licensing | Licensing-UI-Vaadin/src/main/scala/com/magmanics/vaadin/ModelClickListenable.scala | Scala | gpl-3.0 | 2,833 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | saltstar/spark | core/src/test/scala/org/apache/spark/status/AppStatusListenerSuite.scala | Scala | apache-2.0 | 36,631 |
import org.scalatest.FlatSpec
/**
* Created by ganeshchand on 1/9/16.
*/
//BDD style test
class SampleFlatSpecTest extends FlatSpec {
"Any empty Set" should "have size 0" in {
assert(Set.empty.size == 0)
}
it should "produce NoSuchElementException when head is invoked" in {
intercept[NoSuchElementEx... | ganeshchand/learning-scala | src/test/scala/SampleFlatSpecTest.scala | Scala | mit | 364 |
package com.wavesplatform.state.diffs.invoke
import scala.util.Right
import cats.Id
import cats.instances.list._
import cats.syntax.either._
import cats.syntax.semigroup._
import cats.syntax.traverseFilter._
import com.wavesplatform.account._
import com.wavesplatform.common.state.ByteStr
import com.wavesplatform.featu... | wavesplatform/Waves | node/src/main/scala/com/wavesplatform/state/diffs/invoke/InvokeScriptDiff.scala | Scala | mit | 16,547 |
package com.outr.arango.audit
import cats.effect.IO
import com.outr.arango.{Document, Graph}
import com.outr.arango.collection.DocumentCollection
import fabric.Value
import fabric.rw._
trait AuditSupport {
this: Graph =>
val auditLog: DocumentCollection[AuditRecord] = vertex(AuditRecord)
object audit {
de... | outr/scarango | driver/src/main/scala/com/outr/arango/audit/AuditSupport.scala | Scala | mit | 1,004 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | trueyao/spark-lever | streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceivedBlockHandler.scala | Scala | apache-2.0 | 11,801 |
/**
* Copyright (C) 2012 - 101loops.com <dev@101loops.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appli... | crashnote/crashnote-java | modules/logger/src/test/scala/com/crashnote/test/logger/unit/config/LoggerConfigSpec.scala | Scala | apache-2.0 | 1,586 |
import java.net.URL
object Helpers {
def generatePomExtra(scmUrl: String, scmConnection: String,
developerId: String, developerName: String): xml.NodeSeq =
<scm>
<url>{ scmUrl }</url>
<connection>{ scmConnection }</connection>
</scm>
<developers>
<developer>
... | jrudolph/bytecode | project/Helpers.scala | Scala | bsd-2-clause | 425 |
/*
* Copyright (C) 2015 Stratio (http://stratio.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... | fjsc/sparta | serving-core/src/main/scala/com/stratio/sparta/serving/core/models/policy/trigger/TriggerModel.scala | Scala | apache-2.0 | 1,146 |
import scala.math._
class Fraction(n: Int, d: Int) {
private val num: Int = if (d == 0) 1 else n * sign(d) / gcd(n, d);
private val den: Int = if (d == 0) 0 else d * sign(d) / gcd(n, d);
override def toString = num + "/" + den
def sign(a: Int) = if (a > 0) 1 else if (a < 0) -1 else 0
def gcd(a: Int, b: Int):... | yeahnoob/scala-impatient-2e-code | src/ch11/sec08/Fraction.scala | Scala | gpl-3.0 | 720 |
package org.jetbrains.plugins.cbt.project
import com.intellij.openapi.externalSystem.service.task.ui.AbstractExternalSystemToolWindowFactory
class CbtToolWindowFactory
extends AbstractExternalSystemToolWindowFactory(CbtProjectSystem.Id) | triplequote/intellij-scala | cbt/src/org/jetbrains/plugins/cbt/project/CbtToolWindowFactory.scala | Scala | apache-2.0 | 240 |
package org.pdfextractor.algorithm.finder.it
import java.text.{ParseException, SimpleDateFormat}
import java.util.{Date, Locale}
import org.pdfextractor.algorithm.candidate.{CandidateFeatureType, MetaPhraseType}
import org.pdfextractor.algorithm.finder._
import org.pdfextractor.algorithm.finder.it.ItalianRegexPattern... | kveskimae/pdfalg | src/main/scala/org/pdfextractor/algorithm/finder/it/ItalianIssueDateFinder.scala | Scala | mit | 3,023 |
package cromwell.engine.workflow.lifecycle.materialization
import akka.actor.{ActorRef, FSM, LoggingFSM, Props, Status}
import akka.pattern.pipe
import better.files.File
import cats.Monad
import cats.data.EitherT._
import cats.data.Validated.{Invalid, Valid}
import cats.data.{EitherT, NonEmptyList}
import cats.effect.... | ohsu-comp-bio/cromwell | engine/src/main/scala/cromwell/engine/workflow/lifecycle/materialization/MaterializeWorkflowDescriptorActor.scala | Scala | bsd-3-clause | 27,640 |
/*
* Scala.js (https://www.scala-js.org/)
*
* Copyright EPFL.
*
* Licensed under Apache License 2.0
* (https://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package org.scalajs.testing.adapter
import sc... | scala-js/scala-js | test-adapter/src/main/scala/org/scalajs/testing/adapter/RunnerAdapter.scala | Scala | apache-2.0 | 3,067 |
package com.landoop.streamreactor.connect.hive.source.config
import com.datamountaineer.streamreactor.common.config.base.traits.{BaseConfig, ConnectionSettings, ErrorPolicySettings, KcqlSettings, NumberRetriesSettings, UserSettings}
import java.util
import org.apache.kafka.common.config.ConfigDef
import org.apache.ka... | datamountaineer/stream-reactor | kafka-connect-hive-1.1/src/main/scala/com/landoop/streamreactor/connect/hive/source/config/HiveSourceConfigDef.scala | Scala | apache-2.0 | 3,755 |
package io.vertx.scala.tw.service
import io.vertx.lang.scala.json.JsonObject
import io.vertx.scala.ext.web.client.WebClient
import io.vertx.scala.ext.web.codec.BodyCodec
import io.vertx.scala.tw.entity.{RequestToken, Token}
import io.vertx.scala.tw.util.Implicits.RequestTokenConverter
import io.vertx.scala.tw.util.Log... | sczyh30/vertx-twitter-wall | src/main/scala/io/vertx/scala/tw/service/TwitterAuthService.scala | Scala | apache-2.0 | 1,745 |
package io.github.pkmishra.dsascala
class Sorting[T] {
def insertionSort(input: Array[T], f: (T, T) => Boolean) = {
for (i <- 0 to input.length - 1) {
insert(input, i, input(i), f)
}
input.foreach(print)
def insert(input: Array[T], itemPosition: Int, item: T, f: (T, T) => Boolean) =... | pkmishra/scala-playground | dsa-scala/src/main/scala/Sorting.scala | Scala | apache-2.0 | 4,464 |
/*
def toList[A](as:A*): List[A]= match{
case empty => List[Nothing]
case cons(as.head,as.tail) => Cons(as.head,as.tail)
}
these above may be false
*/
def toList:List[A]=this match{
case Cons(h,t) => h()::t().toList //:: assocaite to the right,which is equal to Cons(h(),t().toList) explicit forcing of th... | Tomcruseal/FunctionalLearn | fpinscala/src/main/scala/fpinScala/lazyBoy/helperFunc1.scala | Scala | mit | 657 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | darionyaphet/flink | flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/plan/stream/sql/TableScanTest.scala | Scala | apache-2.0 | 11,104 |
package im.actor.server.migrations
import akka.actor._
import akka.http.scaladsl.util.FastFuture
import akka.util.Timeout
import im.actor.server.db.DbExtension
import im.actor.server.persist.UserRepo
import im.actor.server.persist.contact.{ UserContactRepo, UserEmailContactRepo, UserPhoneContactRepo }
import im.actor.... | EaglesoftZJ/actor-platform | actor-server/actor-core/src/main/scala/im/actor/server/migrations/LocalNamesMigrator.scala | Scala | agpl-3.0 | 3,573 |
package sri
import scala.collection.GenTraversableOnce
import scala.scalajs.js
import scala.scalajs.js.Dynamic.{global => g}
import scala.scalajs.js.JSConverters.JSRichGenTraversableOnce
import scala.scalajs.js.`|`
package object core {
type RefType = js.Function
type PropsChildrenType = ReactElement | js.Array... | hamazy/sri | core/src/main/scala/sri/core/package.scala | Scala | apache-2.0 | 1,576 |
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2015-2021 Andre White.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
... | adarro/ddo-calc | incubating/ddo-provider/src/main/scala/io/truthencode/ddo/subscription/http/AdminApi.scala | Scala | apache-2.0 | 4,314 |
package io.dylemma.spac
package example
import cats.syntax.apply._
import io.dylemma.spac.xml._
import io.dylemma.spac.xml.JavaxSupport._
object Example05_FollowedBy extends App {
val xml ="""<doc>
| <users>
| <user id="1">dylemma</user>
| <user id="2">someone else</user>
| </users>
| <message user_id="1... | dylemma/xml-spac | examples/src/main/scala/io/dylemma/spac/example/Example05_FollowedBy.scala | Scala | mit | 3,922 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | SnappyDataInc/spark | sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/plans/ConstraintPropagationSuite.scala | Scala | apache-2.0 | 17,106 |
/*
* Copyright 2013 - 2017 Outworkers Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... | websudos/morpheus | morpheus-dsl/src/main/scala/com/outworkers/morpheus/Row.scala | Scala | bsd-2-clause | 1,687 |
Subsets and Splits
Filtered Scala Code Snippets
The query filters and retrieves a sample of code snippets that meet specific criteria, providing a basic overview of the dataset's content without revealing deeper insights.