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 |
|---|---|---|---|---|---|
package fpinscala.chapter1.original
class Cafe {
def buyCoffees(creditCard: CreditCard, numOfCoffees: Int): (List[Coffee], Charge) = {
val purchases: List[(Coffee, Charge)] =
List.fill(numOfCoffees)(buyCoffee(creditCard))
val (coffees, charges) = purchases.unzip
(coffees, charges.reduce((c1, c2) =... | dandxy89/LearningScala | src/main/scala/fpinscala/chapter1/original/Cafe.scala | Scala | mit | 498 |
package com.sksamuel.elastic4s.search.queries
import com.sksamuel.elastic4s.RefreshPolicy
import com.sksamuel.elastic4s.testkit.DockerTests
import org.scalatest.{Matchers, WordSpec}
import scala.util.Try
class NestedQueryTest extends WordSpec with DockerTests with Matchers {
Try {
client.execute {
delet... | Tecsisa/elastic4s | elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/queries/NestedQueryTest.scala | Scala | apache-2.0 | 1,697 |
/*
* 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 ... | nickpan47/samza | samza-core/src/test/scala/org/apache/samza/system/TestSystemConsumers.scala | Scala | apache-2.0 | 13,991 |
package org.vaslabs.granger.comms.api
import java.time.ZonedDateTime
import io.circe.{ Decoder, Encoder }
import org.vaslabs.granger.modelv2._
import io.circe.generic.semiauto._
/**
* Created by vnicolaou on 13/06/17.
*/
object model {
case class AddToothInformationRequest(
patientId: PatientId,
to... | vaslabs/granger | src/main/scala/org/vaslabs/granger/comms/api/model.scala | Scala | lgpl-3.0 | 1,541 |
/**
* 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... | samaitra/kafka | core/src/main/scala/kafka/cluster/BrokerEndPoint.scala | Scala | apache-2.0 | 2,901 |
package name.denyago.yasc.chat
import akka.actor.{Actor, ActorRef}
import name.denyago.yasc.chat.events.{ConnectionEstablished, MessagePosted, MessageReceived, UserJoined}
/**
* Actor, holding a WebSocket connection of a particular User.
* Will become connected once WebSocket connection is established
*
* @pa... | denyago/yet-another-simple-chat | src/main/scala/name/denyago/yasc/chat/ConnectedUser.scala | Scala | mit | 817 |
/*
* Copyright 2015-2016 Snowflake Computing
* Copyright 2015 TouchType 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
*
* Un... | snowflakedb/spark-snowflake | src/test/scala/net/snowflake/spark/snowflake/TestUtils.scala | Scala | apache-2.0 | 6,183 |
/*
* 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 ... | hequn8128/flink | flink-libraries/flink-cep-scala/src/test/scala/org/apache/flink/cep/scala/pattern/PatternScalaAPICompletenessTest.scala | Scala | apache-2.0 | 1,652 |
package com.twitter.finagle
import java.net.{SocketAddress, InetSocketAddress}
/**
* A SocketAddress with a weight.
*/
object WeightedSocketAddress {
private case class Impl(
addr: SocketAddress,
weight: Double
) extends SocketAddress
/**
* Create a weighted socket address with weight `weight`.
... | JustinTulloss/finagle | finagle-core/src/main/scala/com/twitter/finagle/WeightedSocketAddress.scala | Scala | apache-2.0 | 1,129 |
import sbt._
object Dependencies {
val kafka = "com.typesafe.akka" %% "akka-stream-kafka" % Versions.akka_kafka
val logback = "ch.qos.logback" % "logback-classic" % Versions.logback
val log4j_over_slf4j = "org.slf4j" % "log4j-over-slf4j" % Versions.log4j_over_slf4j
val akka_slf4j = "com.typesafe.akka" %% "a... | omearac/reactive-kafka-microservice-template | project/Dependencies.scala | Scala | apache-2.0 | 834 |
import scala.util.Random
import scala.annotation.tailrec
/**
* "Ants" traverse a graph of locations to produce random tours.
*
* The choice of which location to visit next ("state transition") is
* probabalistic, and weighted by both the distance and amount of pheromone
* deposited between locations.
*/
abstract... | hakuch/TravellingAnts | src/main/scala/Ant.scala | Scala | mit | 3,725 |
package sorm.core
sealed trait DbType
object DbType {
case object Mysql extends DbType
case object H2 extends DbType
case object Hsqldb extends DbType
case object Sqlite extends DbType
case object Postgres extends DbType
case object Oracle extends DbType
case object Sqlserver extends DbType
case objec... | cllu/sorm2 | src/main/scala/sorm/core/DbType.scala | Scala | mit | 1,482 |
package controllers.namedslices.admin
import controllers.{ CRUDController, OrganizationController }
import models._
import com.escalatesoft.subcut.inject.BindingModule
import play.api.mvc._
import play.api.data.Form
import play.api.data.Forms._
import com.mongodb.casbah.Imports._
import play.api.data.validation.Constr... | delving/culture-hub | modules/namedSlices/app/controllers/namedslices/admin/NamedSlices.scala | Scala | apache-2.0 | 2,687 |
/*
* Copyright 2001-2015 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 agre... | dotty-staging/scalatest | examples/src/test/scala/org/scalatest/examples/asyncfreespec/composingwithasyncfixture/ExampleSpec.scala | Scala | apache-2.0 | 3,404 |
/*
* Licensed to Intel Corporation under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* Intel Corporation licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use t... | SeaOfOcean/BigDL | dl/src/main/scala/com/intel/analytics/bigdl/nn/SpatialContrastiveNormalization.scala | Scala | apache-2.0 | 3,731 |
package reaktor.scct.report
import org.specs2.mutable._
import java.io.File
import reaktor.scct.{IO, ClassTypes, Name, CoveredBlock}
import xml.XML
import org.specs2.specification.Scope
class CoberturaReporterSpec extends Specification {
sequential
val tmpDir = new File(System.getProperty("java.io.tmpdir", "/tm... | mtkopone/scct | src/test/scala/reaktor/scct/report/CoberturaReporterSpec.scala | Scala | apache-2.0 | 2,443 |
package dotty.tools.backend.jvm
import scala.language.unsafeNulls
import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.ast.Trees.{PackageDef, ValDef}
import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.core.Phases.Phase
import scala.collection.mutable
import scala.collection.JavaConverters._
import do... | dotty-staging/dotty | compiler/src/dotty/tools/backend/jvm/GenBCode.scala | Scala | apache-2.0 | 22,852 |
package no.nextgentel.oss.akkatools.persistence.jdbcjournal
import java.time.{OffsetDateTime, ZoneId}
import java.util.Date
import javax.sql.DataSource
import no.nextgentel.oss.akkatools.cluster.ClusterNodeRepo
import org.slf4j.LoggerFactory
import org.sql2o.data.Row
import org.sql2o.quirks.OracleQuirks
import org.sq... | NextGenTel/akka-tools | akka-tools-jdbc-journal/src/main/scala/no/nextgentel/oss/akkatools/persistence/jdbcjournal/StorageRepoImpl.scala | Scala | mit | 11,993 |
package com.twitter.util
import com.twitter.conversions.time._
import java.util.concurrent.{CancellationException, ExecutorService}
import java.util.concurrent.atomic.AtomicInteger
import org.junit.runner.RunWith
import org.mockito.ArgumentCaptor
import org.mockito.Matchers.any
import org.mockito.Mockito.{never, verif... | BuoyantIO/twitter-util | util-core/src/test/scala/com/twitter/util/TimerTest.scala | Scala | apache-2.0 | 9,836 |
/*
* Copyright 2009-2010 LinkedIn, 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 agreed ... | thesiddharth/norbert | network/src/main/scala/com/linkedin/norbert/network/ResponseIterator.scala | Scala | apache-2.0 | 2,656 |
package ee.cone.c4gate
import java.util.UUID
import ee.cone.c4actor.LEvent.{delete, update}
import ee.cone.c4actor._
import ee.cone.c4assemble._
import ee.cone.c4gate.CommonFilterProtocol._
import ee.cone.c4gate.TestTodoProtocol.B_TodoTask
import ee.cone.c4proto._
import ee.cone.c4ui._
import ee.cone.c4vdom.{TagStyles... | wregs/c4proto | c4gate-sse-example/src/main/scala/ee/cone/c4gate/TestTodo.scala | Scala | apache-2.0 | 4,891 |
package com.github.al.roulette.player.api
import java.util.UUID
import akka.NotUsed
import com.github.al.roulette.player.api.PlayerService.PlayerEventTopicName
import com.lightbend.lagom.scaladsl.api.broker.Topic
import com.lightbend.lagom.scaladsl.api.{Descriptor, Service, ServiceCall}
trait PlayerService extends S... | andrei-l/reactive-roulette | player-api/src/main/scala/com/github/al/roulette/player/api/PlayerService.scala | Scala | mit | 965 |
package com.bigjason.semver
trait SemVerTestingSupport {
}
| bigjason/semver | src/test/scala/com/bigjason/semver/SemVerTestingSupport.scala | Scala | apache-2.0 | 61 |
/*
* Copyright (C) 2014 - 2017 Contributors as noted in the AUTHORS.md file
*
* 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 Foundation, either version 3 of the
* License, or (at your option)... | Tensei-Data/tensei-agent | src/main/scala/com/wegtam/tensei/agent/processor/MapperMessages.scala | Scala | agpl-3.0 | 3,250 |
/*
* Copyright (C) 2017 Michael Dippery <michael@monkey-robot.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 requi... | mdippery/jupiter | src/main/scala/com/mipadi/jupiter/text/strings.scala | Scala | apache-2.0 | 2,203 |
package org.jetbrains.plugins.scala.failed.annotator
import java.io.File
import com.intellij.openapi.util.TextRange
import org.jetbrains.plugins.scala.PerfCycleTests
import org.jetbrains.plugins.scala.projectHighlighting.ScalacTestdataHighlightingTestBase
import org.jetbrains.plugins.scala.util.TestUtils
import org.j... | jastice/intellij-scala | scala/scala-impl/test/org/jetbrains/plugins/scala/failed/annotator/FailedScalacTests.scala | Scala | apache-2.0 | 5,919 |
/*
*
* 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 writing, software
* distri... | flaminem/flamy | src/main/scala/com/flaminem/flamy/exec/hive/ModelHiveFunctionFetcher.scala | Scala | apache-2.0 | 1,036 |
package com.twitter.finagle.netty4
import com.twitter.concurrent.NamedPoolThreadFactory
import com.twitter.finagle._
import com.twitter.finagle.netty4.channel.{ServerBridge, Netty4ChannelInitializer}
import com.twitter.finagle.netty4.transport.ChannelTransport
import com.twitter.finagle.server.Listener
import com.twit... | liamstewart/finagle | finagle-netty4/src/main/scala/com/twitter/finagle/netty4/Netty4Listener.scala | Scala | apache-2.0 | 5,799 |
package org.openurp.edu.eams.teach.program.major.service
import org.openurp.edu.base.Adminclass
import org.openurp.edu.base.Course
import org.openurp.edu.base.code.CourseType
import org.openurp.edu.teach.plan.CoursePlan
import org.openurp.edu.teach.plan.PlanCourse
import org.openurp.edu.teach.plan.MajorPlan
import o... | openurp/edu-eams-webapp | core/src/main/scala/org/openurp/edu/eams/teach/program/major/service/MajorPlanService.scala | Scala | gpl-3.0 | 1,191 |
/* SimpleApp.scala */
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
object SimpleApp {
def main(args: Array[String]) {
val logFile = "/opt/spark-1.1.0-bin-hadoop2.4/README.md" // Should be some file on your system
//val logFile = "/Users/ryanlei... | RyanLeiTaiwan/SparkPractice | QuickStart/src/main/scala/SimpleApp.scala | Scala | gpl-3.0 | 748 |
package com.twitter.finagle.zookeeper
import com.twitter.common.zookeeper.ServerSetImpl
import com.twitter.conversions.time._
import com.twitter.finagle.{Addr, Resolver}
import com.twitter.thrift.Status._
import com.twitter.util.{Await, Duration, RandomSocket, Var}
import java.net.InetSocketAddress
import org.junit.ru... | liamstewart/finagle | finagle-serversets/src/test/scala/com/twitter/finagle/zookeeper/ZkResolverTest.scala | Scala | apache-2.0 | 5,726 |
package mytest.casematch
/**
* Created by fqc on 2016/7/23.
* 提取器
*/
class Extractor {
}
trait User {
def name: String
}
class FreeUser(val name: String) extends User
class PremiumUser(val name: String) extends User
object FreeUser {
def unapply(user: FreeUser): Option[String] = Some(user.name)
}
obje... | fqc/Scala_sidepro | src/mytest/casematch/Extractor.scala | Scala | mit | 986 |
/*
* Beangle, Agile Development Scaffold and Toolkits.
*
* Copyright © 2005, The Beangle Software.
*
* 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 3 of the License... | beangle/maven | src/main/scala/org/beangle/maven/plugin/container/DiffMojo.scala | Scala | lgpl-3.0 | 3,678 |
package mesosphere.marathon.core.flow
import mesosphere.marathon.MarathonSchedulerDriverHolder
import mesosphere.marathon.core.base.Clock
import mesosphere.marathon.core.flow.impl.{ OfferMatcherLaunchTokensActor, ReviveOffersActor }
import mesosphere.marathon.core.leadership.LeadershipModule
import mesosphere.marathon... | HardikDR/marathon | src/main/scala/mesosphere/marathon/core/flow/FlowModule.scala | Scala | apache-2.0 | 2,425 |
/*
* Copyright 2020 Precog Data
*
* 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 ... | djspiewak/quasar | foundation/src/main/scala/quasar/contrib/scalaz/nel.scala | Scala | apache-2.0 | 978 |
package video.imageUtils
import scala.util.Random
import java.awt.Color
import java.awt.image.BufferedImage
object ImageUtils {
val rand = new Random()
def randColor = {
val r: Float = rand.nextFloat()
val g: Float = rand.nextFloat()
val b: Float = rand.nextFloat()
new Color(r, g, b)
}
def ... | retroryan/streams-workshop | src/library/video/imageUtils/ImageUtils.scala | Scala | cc0-1.0 | 682 |
package coursier.clitests
import java.io.File
import utest._
abstract class LaunchTests extends TestSuite {
def launcher: String
val tests = Tests {
test("fork") {
val output = LauncherTestUtil.output(
launcher,
"launch",
"--fork",
"io.get-coursier:echo:1.0.1",
... | alexarchambault/coursier | modules/cli-tests/src/main/scala/coursier/clitests/LaunchTests.scala | Scala | apache-2.0 | 2,821 |
package com.twitter.finagle.kestrel
import _root_.java.net.SocketAddress
import org.jboss.netty.buffer.ChannelBuffer
import com.twitter.finagle.builder.{Server => BuiltServer, ServerBuilder}
import protocol.Kestrel
import _root_.java.util.concurrent.{BlockingDeque, LinkedBlockingDeque}
import com.twitter.util.MapMaker... | enachb/finagle_2.9_durgh | finagle-kestrel/src/main/scala/com/twitter/finagle/kestrel/Server.scala | Scala | apache-2.0 | 1,066 |
/*
* 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 ... | minixalpha/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/types/UserDefinedType.scala | Scala | apache-2.0 | 4,236 |
package org.jetbrains.plugins.scala
package caches
import java.util.concurrent.ConcurrentMap
import java.util.concurrent.atomic.AtomicReference
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.openapi.util._
import com.intellij.psi._
import com.intellij.psi.impl.compiled.ClsFileImpl
import co... | jastice/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/caches/CachesUtil.scala | Scala | apache-2.0 | 7,744 |
/*
* 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 ... | aosagie/spark | sql/core/src/test/scala/org/apache/spark/sql/streaming/test/DataStreamReaderWriterSuite.scala | Scala | apache-2.0 | 23,374 |
/*
* 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 ... | tophua/spark1.52 | mllib/src/main/scala/org/apache/spark/ml/regression/GBTRegressor.scala | Scala | apache-2.0 | 8,710 |
package io.udash.css
import io.udash.testing.UdashSharedTest
import scala.io.Source
class CssFileRendererTest extends UdashSharedTest {
val stylesheets = Seq(StylesheetExample, SecondStylesheetExample)
val testDir = "target/CssFileRendererTest"
"CssFileRenderer" should {
"render stylesheets to file" in {
... | UdashFramework/udash-core | css/.jvm/src/test/scala/io/udash/css/CssFileRendererTest.scala | Scala | apache-2.0 | 5,158 |
import sbt._
import Keys._
object SoqlToy {
lazy val settings: Seq[Setting[_]] = BuildSettings.projectSettings(assembly = true) ++ Seq(
name := "soql-toy",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-simple" % BuildSettings.slf4jVersion,
"org.scalacheck" %% "scalacheck" % "1.14.0" % "test")... | socrata-platform/soql-reference | project/SoqlToy.scala | Scala | apache-2.0 | 327 |
// tests exhaustivity doesn't give warnings (due to its heuristic rewrites kicking in or it backing off)
object Test {
// List() => Nil
List(1) match {
case List() =>
case x :: xs =>
}
// we don't look into guards
val turnOffChecks = true
List(1) match {
case _ if turnOffChecks =>
}
// we ... | loskutov/intellij-scala | testdata/scalacTests/pos/exhaustive_heuristics.scala | Scala | apache-2.0 | 824 |
/*
* Copyright 2016 The BigDL Authors.
*
* 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... | intel-analytics/BigDL | scala/dllib/src/test/scala/com/intel/analytics/bigdl/dllib/integration/torch/ClassSimplexCriterionSpec.scala | Scala | apache-2.0 | 2,041 |
/*
* (c) Copyright 2016 Hewlett Packard Enterprise Development LP
*
* 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 b... | hpe-cct/cct-core | src/main/scala/cogdebugger/ui/components/MousePanAndZoom.scala | Scala | apache-2.0 | 11,534 |
/*
* 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 ... | shuangshuangwang/spark | sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala | Scala | apache-2.0 | 72,272 |
package org.kongo.kafka.metrics
import java.util.Collections
import java.util.Properties
import kafka.utils.VerifiableProperties
import org.apache.kafka.common.{MetricName => KMetricName}
import org.apache.kafka.common.Metric
import org.kongo.kafka.metrics.config.KafkaStatsdReporterConfig
import org.kongo.kafka.metri... | kongo2002/kafka-statsd-reporter | src/test/scala/org/kongo/kafka/metrics/TestUtils.scala | Scala | apache-2.0 | 1,690 |
package org.hammerlab.guacamole
import org.apache.spark.rdd.RDD
import org.hammerlab.genomics.reference.{ContigName, NumLoci}
import org.hammerlab.guacamole.reads.MappedRead
import org.hammerlab.guacamole.readsets.ContigLengths
import org.hammerlab.guacamole.readsets.rdd.PartitionedRegions
/**
* This package contain... | hammerlab/guacamole | src/main/scala/org/hammerlab/guacamole/readsets/package.scala | Scala | apache-2.0 | 959 |
package stefansavev.demo.hyperloglog.counters
import org.elasticsearch.common.util.BigArrays
import org.elasticsearch.search.aggregations.metrics.cardinality.HyperLogLogPlusPlus
import stefansavev.demo.hyperloglog.hashing.Hasher
class ElasticSearchHLLPP(hasher: Hasher) extends ApproximateCounter{
//using one bucket... | dvgodoy/HashingAndSketching | out/production/hyperloglog/stefansavev/demo/hyperloglog/counters/ElasticSearchHLLPP.scala | Scala | apache-2.0 | 579 |
package org.inosion.dadagen
import scala.collection.JavaConverters._
/**
* Java Implementation of the RandomDataGenerator
*
* Appending 'J' Little bit code smelly (TODO : resolve a better Java API design)
*
* @tparam A
*/
abstract class RandomDataGeneratorJ[A] extends Dadagenerator[A] {
def generateAllJ(rows... | inosion/dadagen | dadagen-core/src/main/scala/org/inosion/dadagen/RandomDataGeneratorJ.scala | Scala | apache-2.0 | 447 |
package com.featurefm.metrics
import akka.actor._
import com.codahale.metrics.MetricRegistry
class MetricsExtension(extendedSystem: ExtendedActorSystem) extends Extension {
// Allow access to the extended system
val system = extendedSystem
// The application wide metrics registry.
val metricRegistry = new Me... | ListnPlay/Kastomer | src/main/scala/com/featurefm/metrics/MetricsExtension.scala | Scala | mit | 905 |
/*
* 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 ... | icexelloss/spark | core/src/test/scala/org/apache/spark/scheduler/TaskSchedulerImplSuite.scala | Scala | apache-2.0 | 58,511 |
/*
* This file is part of AckCord, licensed under the MIT License (MIT).
*
* Copyright (c) 2019 Katrix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including ... | Katrix-/AckCord | exampleCore/src/main/scala/ackcord/examplecore/Example.scala | Scala | mit | 13,514 |
/*
* Copyright (c) 2015,
* Ilya Sergey, Christopher Earl, Matthew Might and David Van Horn
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain t... | ilyasergey/reachability | src/org/ucombinator/lambdajs/parsing/LambdaJSParser.scala | Scala | bsd-3-clause | 17,245 |
package com.caibowen.webface.gae.store
import java.util.{ArrayList => JArrList, HashMap => JHashMap, HashSet => JHashSet, List => JList, Map => JMap, Set => JSet}
import com.caibowen.gplume.misc.Str.Utils
import com.caibowen.webface.gae.R
import com.caibowen.webface.gae.misc.ReqLocation
import com.google.appen... | xkommando/WebFace | src/com/caibowen/webface/gae/store/VisitCount.scala | Scala | apache-2.0 | 9,241 |
package io.finch.test.json
import argonaut.{CodecJson, DecodeJson, EncodeJson, Parse}
import argonaut.Argonaut.{casecodec3, casecodec5}
import com.twitter.io.Buf.Utf8
import com.twitter.io.Charsets
import com.twitter.util.Return
import io.finch.{Decode, Encode}
import org.scalacheck.Arbitrary
import org.scalacheck.Arb... | ilya-murzinov/finch | json-test/src/main/scala/io/finch/test/json/JsonCodecProviderProperties.scala | Scala | apache-2.0 | 4,673 |
package com.github.chawasit.smc.simulator
trait TryWith {
def TryWith[T](guards: Guard*)(block: => T): T = {
guards foreach {_.execute()}
block
}
case class Guard(condition: Boolean, exception: Throwable) {
def execute(): Unit = if (!condition) throw exception
}
}
| chawasit/Scala-SMC-Simulator | src/main/scala/com/github/chawasit/smc/simulator/TryWith.scala | Scala | unlicense | 301 |
package scala.generator
import com.bryzek.apidoc.spec.v0.models.{Field, Model}
object PrimitiveWrapper {
val FieldName = "value"
def className(union: ScalaUnion, primitive: ScalaPrimitive): String = {
primitive match {
case ScalaPrimitive.Boolean | ScalaPrimitive.Double | ScalaPrimitive.Integer | Scal... | movio/movio-apidoc-generator | scala-generator/src/main/scala/models/generator/PrimitiveWrapper.scala | Scala | mit | 2,329 |
/*
* Copyright 2016 The BigDL Authors.
*
* 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... | JerryYanWan/BigDL | spark/dl/src/test/scala/com/intel/analytics/bigdl/nn/MeanSpec.scala | Scala | apache-2.0 | 1,378 |
/**
* Copyright 2013 Genome Bridge 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 applicable law or agr... | fnothaft/adam | adam-core/src/main/scala/edu/berkeley/cs/amplab/adam/util/Histogram.scala | Scala | apache-2.0 | 2,928 |
package org.phasanix.svggraph
import java.awt.Color
import java.awt.geom.{Point2D, Rectangle2D}
import RichColor.color2richcolor
/**
* Configuration options.
*
* Measurements are all in px.
*/
case class Options (
layout: Options.Layout,
font: Options.Font,
draw: Options.Draw
) {
def plotArea: Rectangle2D... | richardclose/svggraph | src/main/scala/org/phasanix/svggraph/Options.scala | Scala | mit | 3,970 |
package ru.smslv.akka.dns
import java.net.InetSocketAddress
import akka.io.AsyncDnsResolver
import org.scalatest.{Matchers, WordSpec}
class NameserverAddressParserSpec extends WordSpec with Matchers {
"Parser" should {
"handle explicit port in IPv4 address" in {
AsyncDnsResolver.parseNameserverAddress("8... | ilya-epifanov/akka-dns | src/test/scala/ru/smslv/akka/dns/NameserverAddressParserSpec.scala | Scala | apache-2.0 | 942 |
/***********************************************************************
* Copyright (c) 2013-2017 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... | ronq/geomesa | geomesa-accumulo/geomesa-accumulo-tools/src/main/scala/org/locationtech/geomesa/accumulo/tools/stats/AccumuloStatsTopKCommand.scala | Scala | apache-2.0 | 1,145 |
/*
* Copyright 2014-2016 Panavista Technologies, 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... | ndwade/def-trade | ib-client/src/main/scala/io/deftrade/services.scala | Scala | apache-2.0 | 11,778 |
package com.sksamuel.elastic4s.streams
import akka.actor.{Actor, ActorRef, ActorSystem, Props, Cancellable}
import com.sksamuel.elastic4s.{BulkCompatibleDefinition, ElasticClient, ElasticDsl}
import org.elasticsearch.action.bulk.{BulkItemResponse, BulkResponse}
import org.reactivestreams.{Subscriber, Subscription}
im... | tototoshi/elastic4s | elastic4s-streams/src/main/scala/com/sksamuel/elastic4s/streams/BulkIndexingSubscriber.scala | Scala | apache-2.0 | 6,845 |
package com.greencatsoft.angularjs
import scala.language.experimental.macros
import scala.scalajs.js
class Module private[angularjs] (val module: internal.Module) {
require(module != null, "Missing argument 'module'.")
import internal.{ Angular => angular }
def config[A <: Config](target: A): Module = macro a... | svenwiegand/scalajs-angular | src/main/scala/com/greencatsoft/angularjs/Module.scala | Scala | apache-2.0 | 2,185 |
package sharry.restserver.routes.tus
import sharry.common.ByteSize
import org.http4s._
import org.typelevel.ci.CIString
object SharryFileLength {
def apply[F[_]](req: Request[F]): Option[ByteSize] =
sizeHeader(req, "sharry-file-length").orElse(sizeHeader(req, "upload-length"))
private[tus] def sizeHeader[F... | eikek/sharry | modules/restserver/src/main/scala/sharry/restserver/routes/tus/SharryFileLength.scala | Scala | gpl-3.0 | 469 |
/*
* Copyright 2011-2017 Chris de Vreeze
*
* 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... | dvreeze/yaidom | jvm/src/test/scala/eu/cdevreeze/yaidom/queryapitests/indexed/XmlBaseTest.scala | Scala | apache-2.0 | 2,138 |
/*
* Copyright 2014–2018 SlamData 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... | jedesah/Quasar | web/src/main/scala/quasar/server/Server.scala | Scala | apache-2.0 | 9,114 |
package com.alanjz.meerkat.app.tabs
import java.awt.Dimension
import javax.swing.JPanel
abstract class MCTab {
private val panel = new JPanel()
this.setPreferredSize(new Dimension(300, 650))
def toJPanel = panel
}
object MCTab {
implicit def toJPanel(lhs : MCTab) : JPanel = lhs.toJPanel
} | spacenut/meerkat-chess | src/com/alanjz/meerkat/app/tabs/MCTab.scala | Scala | gpl-2.0 | 302 |
/*
* Copyright 2014 Treode, 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 agreed to... | Treode/store | jackson/test/com/treode/jackson/PreferenceSpec.scala | Scala | apache-2.0 | 1,043 |
package vggames.browser
import org.openqa.selenium.WebDriver
import org.openqa.selenium.firefox.FirefoxDriver
import org.specs2.mutable.Specification
import org.specs2.runner.JUnitRunner
import org.openqa.selenium.By
import org.openqa.selenium.JavascriptExecutor
trait WebBrowser {
var driver = new FirefoxDriver
... | vidageek/games | web/src/test/scala/vggames/browser/WebBrowser.scala | Scala | gpl-3.0 | 871 |
/*
* 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 ... | mahak/spark | mllib/src/test/scala/org/apache/spark/mllib/optimization/GradientDescentSuite.scala | Scala | apache-2.0 | 6,783 |
package sh.webserver
object Runner {
def main(args: Array[String]): Unit = {
new Server(1337).start()
}
} | stefan-hering/scalaserver | src/main/sh/webserver/Runner.scala | Scala | apache-2.0 | 114 |
package com.lightning.walletapp.ln.wire
import java.net._
import scodec.codecs._
import fr.acinq.eclair.UInt64.Conversions._
import scodec.bits.{BitVector, ByteVector}
import com.lightning.walletapp.ln.crypto.{Mac32, Sphinx}
import fr.acinq.bitcoin.Crypto.{Point, PublicKey, Scalar}
import scodec.{Attempt, Codec, Deco... | btcontract/lnwallet | app/src/main/java/com/lightning/walletapp/ln/wire/LightningMessageCodecs.scala | Scala | apache-2.0 | 32,153 |
/*
* Copyright (c) 2014-2021 by The Monix Project Developers.
* See the project homepage at: https://monix.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... | monixio/monix | monix-reactive/shared/src/test/scala/monix/reactive/internal/operators/BufferSlidingSuite.scala | Scala | apache-2.0 | 1,742 |
/*
* 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/ct-calculations | src/test/scala/uk/gov/hmrc/ct/computations/MachineryAndPlantValidationSpec.scala | Scala | apache-2.0 | 21,860 |
package models.persistance
import models.LocalDirectory
import models.LocalDirectoryTable
import play.api.db.slick.Config.driver.simple._
object LocalDirectoryDAO {
val localDirectories = TableQuery[LocalDirectoryTable]
def getAllDirectories() = { implicit session: Session =>
localDirectories.list
}... | seqprodbio/restoule | app/models/persistance/LocalDirectoryDAO.scala | Scala | gpl-3.0 | 517 |
#!/bin/bash
scala $0 $@
exit
!#
/*
A demonstration of implicits for embedding
domain-specific languages in Scala. In this
case, the DSL creates an AST for regular expressions.
Exercise: Implement a matchesString method for RegEx
*/
abstract class RegEx {
def ~ (right : RegEx) = Sequence(this,right)
def |... | pmsg863/xmgps | vertx3test/src/main/resources/twittleschool/read/Implicits.scala | Scala | apache-2.0 | 1,515 |
/*
* 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... | adarro/ddo-calc | subprojects/common/ddo-core/src/main/scala/io/truthencode/ddo/model/feats/ConstructExemplar.scala | Scala | apache-2.0 | 1,568 |
package nodes.util
import breeze.linalg.SparseVector
import org.apache.spark.rdd.RDD
import workflow.Estimator
import scala.reflect.ClassTag
/**
* An Estimator that chooses the most frequently observed sparse features when training,
* and produces a transformer which builds a sparse vector out of them
*
* Determ... | o0neup/keystone | src/main/scala/nodes/util/CommonSparseFeatures.scala | Scala | apache-2.0 | 1,605 |
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.{ToolBox, ToolBoxError}
object Test extends dotty.runtime.LegacyApp {
val tb = cm.mkToolBox()
try tb.parse("f(x")
catch {
case ToolBoxError(msg, _) => println(msg)
}
}
| yusuke2255/dotty | tests/pending/run/t7331b.scala | Scala | bsd-3-clause | 299 |
package it.jugtofunprog
object Sugar {;import org.scalaide.worksheet.runtime.library.WorksheetSupport._; def main(args: Array[String])=$execute{;$skip(695);
// Given n>0 find all pairs i and j where 1 <= j <= i <= n and i+j is prime
/** Java 8 version (by Mario Fusco)
http://www.slideshare.net/mariofusco/mo... | vraffy/JugToFunProg | jtfp-scala/.worksheet/src/it.jugtofunprog.Sugar.scala | Scala | apache-2.0 | 1,616 |
package blended.jms.bridge.internal
import akka.stream.KillSwitch
import blended.jms.utils.IdAwareConnectionFactory
import blended.streams.message.FlowEnvelope
import blended.testsupport.RequiresForkedJVM
import scala.concurrent.duration._
import org.osgi.framework.BundleActivator
import blended.jms.utils.BlendedSing... | woq-blended/blended | blended.jms.bridge/src/test/scala/blended/jms/bridge/internal/SessionFailRetrySpec.scala | Scala | apache-2.0 | 8,362 |
/*
Copyright 2014 - 2015 Janek Bogucki
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 o... | janekdb/scalacraft-domain | src/main/scala/com/scalacraft/domain/v2/internal/ex/NullElementException.scala | Scala | apache-2.0 | 1,095 |
/*
* The MIT License
*
* Copyright (c) 2017 Fulcrum Genomics LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to us... | fulcrumgenomics/fgbio | src/main/scala/com/fulcrumgenomics/umi/CollectDuplexSeqMetrics.scala | Scala | mit | 32,716 |
/* Copyright 2017-19, Emmanouil Antonios Platanios. 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/licenses/LICENSE-2.0
*
* Unless ... | eaplatanios/tensorflow_scala | modules/api/src/main/scala/org/platanios/tensorflow/api/learn/Mode.scala | Scala | apache-2.0 | 1,164 |
package mgoeminne.scalaggplot.coord
/**
* Polar coordinates.
*
* The polar coordinate system is most commonly used for pie charts, which are a stacked bar chart in polar coordinates.
*
* == Examples ==
*
* TODO
*
* @param thetaFromX determines if the variable to map to angle must be x, or y. If true, x is use... | mgoeminne/scala-ggplot | src/main/scala/mgoeminne/scalaggplot/coord/polar.scala | Scala | lgpl-3.0 | 666 |
package io.udash.web.guide.views.ext.demo
import io.udash.css.CssView
import io.udash.web.guide.demos.AutoDemo
import io.udash.web.guide.styles.partials.GuideStyles
import scalatags.JsDom.all._
object JQueryCallbacksDemo extends AutoDemo with CssView {
private val (rendered, source) = {
import io.udash.bootstr... | UdashFramework/udash-core | guide/guide/.js/src/main/scala/io/udash/web/guide/views/ext/demo/JQueryCallbacksDemo.scala | Scala | apache-2.0 | 1,870 |
/*
* Copyright 2014–2018 SlamData 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... | slamdata/slamengine | qsu/src/main/scala/quasar/qsu/Access.scala | Scala | apache-2.0 | 2,862 |
/**
* 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... | robort/kafka | core/src/test/scala/unit/kafka/server/HighwatermarkPersistenceTest.scala | Scala | apache-2.0 | 6,998 |
package models.domain.redis
import redis.clients.jedis.Jedis
import play.api.libs.json._
/**
* @author kamekoopa
*/
case class Record(key: Key, value: RedisValue, ttl: Long){
val isNoExpiration: Boolean = ttl == -1
}
object Record {
lazy val strArr: Array[String] = Array[String]()
def apply(keyName: Strin... | kamekoopa/redis-miruo | app/models/domain/redis/Record.scala | Scala | apache-2.0 | 1,402 |
package org.jetbrains.plugins.scala.lang.scaladoc.psi.api
import com.intellij.psi.impl.source.tree.LeafPsiElement
import com.intellij.psi.javadoc.PsiDocTag
import org.jetbrains.plugins.scala.lang.psi.api.ScalaPsiElement
trait ScDocTag extends ScalaPsiElement with PsiDocTag | JetBrains/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/lang/scaladoc/psi/api/ScDocTag.scala | Scala | apache-2.0 | 275 |
package fpinscala.ch03_datastructures
import annotation.tailrec
sealed trait List[+A]
case object Nil extends List[Nothing]
case class Cons[+A](head: A, tail: List[A]) extends List[A]
object List {
def apply[A](as: A*): List[A] =
if (as.isEmpty) Nil
else Cons(as.head, apply(as.tail: _*))
// Exercise... | shajra/fpinscala-exercises-shajra | exercises/src/main/scala/fpinscala/ch03_datastructures/List.scala | Scala | mit | 3,302 |
package org.bfn.ninetynineprobs
import org.scalatest._
class P26Spec extends UnitSpec {
"combinations" should "return one empty list when N=0" in {
assert(P26.combinations(0, List(1, 2, 3)) == List(List()))
}
it should "return one list per item when N=1" in {
val myList = List(3, 2, 1, 5)
assert(P... | bfontaine/99Scala | src/test/scala/P26Spec.scala | Scala | mit | 839 |
/**
* Copyright (C) 2017 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... | orbeon/orbeon-forms | form-runner/jvm/src/main/scala/org/orbeon/oxf/fr/persistence/relational/rest/LockInfo.scala | Scala | lgpl-2.1 | 2,277 |
package org.phenoscape.scowl.ofn
import org.phenoscape.scowl.converters.{SWRLArgs, SWRLDArgish, SWRLIArgish}
import org.semanticweb.owlapi.apibinding.OWLManager
import org.semanticweb.owlapi.model._
import scala.jdk.CollectionConverters._
trait SWRL {
private val factory = OWLManager.getOWLDataFactory
object D... | phenoscape/scowl | src/main/scala/org/phenoscape/scowl/ofn/SWRL.scala | Scala | mit | 4,546 |
/*******************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013,2014 by Peter Pilgrim, Addiscombe, Surrey, XeNoNiQUe UK
*
* All rights reserved. This program and the accompanying materials
* are made available under... | peterpilgrim/digital-scala-javaone-2014 | src/test/scala/uk/co/xenonique/digitalone/GradleDependency.scala | Scala | gpl-3.0 | 2,011 |
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.