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 org.flowpaint.util
import org.flowpaint.model2.raster.Change
import org.flowpaint.model2.{Operation, Picture}
/**
* A command to run a rendering operation.
*/
class OperationCommand(operation: Operation) extends Command[Picture](
operation.description,
// Action
(picture: Picture) => {
// val tiles... | zzorn/flowpaint | src/main/scala/org/flowpaint/util/OperationCommand.scala | Scala | gpl-2.0 | 792 |
package jp.co.dzl.example.akka.api.di
import com.typesafe.config.{ ConfigFactory, Config }
import scaldi.Module
class ConfigModule extends Module {
bind[Config] to ConfigFactory.load()
bind[String] identifiedBy "http.listen.host" to inject[Config].getString("http.listen.host")
bind[Int] identifiedBy "http.list... | dazzle-lab/akka-api-gateway-example | src/main/scala/jp/co/dzl/example/akka/api/di/ConfigModule.scala | Scala | mit | 680 |
/*
* 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 ... | manuzhang/incubator-gearpump | core/src/main/scala/org/apache/gearpump/cluster/scheduler/Scheduler.scala | Scala | apache-2.0 | 2,856 |
package sbt
import java.io.File
import Def.Classpath
import scala.annotation.implicitNotFound
import sbt.internal.util.Attributed
import Def.Initialize
import reflect.internal.annotations.compileTimeOnly
object Append {
@implicitNotFound(
msg = "No implicit for Append.Value[${A}, ${B}] found,\\n so ${B} cannot... | Duhemm/sbt | main-settings/src/main/scala/sbt/Append.scala | Scala | bsd-3-clause | 4,139 |
package lila.tournament
import org.specs2.mutable.Specification
object ColorHistoryTest {
def apply(s: String): ColorHistory = {
s.foldLeft(ColorHistory(0, 0)) { (acc, c) =>
c match {
case 'W' => acc.inc(chess.White)
case 'B' => acc.inc(chess.Black)
}
}
}
def toTuple2(history:... | luanlv/lila | modules/tournament/src/test/ColorHistoryTest.scala | Scala | mit | 1,950 |
/*
* 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... | monix/monix | monix-tail/shared/src/test/scala/monix/tail/IterantDropWhileSuite.scala | Scala | apache-2.0 | 3,583 |
package org.jetbrains.plugins.scala.actions
import java.util
import java.util.Collections
import com.intellij.openapi.actionSystem.{ActionPromoter, AnAction, DataContext}
/**
* User: Dmitry.Naydanov
* Date: 28.02.17.
*/
abstract class SingleActionPromoterBase extends ActionPromoter {
def shouldPromote(anActi... | ilinum/intellij-scala | src/org/jetbrains/plugins/scala/actions/SingleActionPromoterBase.scala | Scala | apache-2.0 | 626 |
package com.sksamuel.elastic4s.search.aggs
import com.sksamuel.elastic4s.RefreshPolicy
import com.sksamuel.elastic4s.testkit.DockerTests
import org.scalatest.{FreeSpec, Matchers}
import scala.util.Try
class ExtendedStatsAggregationHttpTest extends FreeSpec with DockerTests with Matchers {
Try {
client.execute... | Tecsisa/elastic4s | elastic4s-tests/src/test/scala/com/sksamuel/elastic4s/search/aggs/ExtendedStatsAggregationHttpTest.scala | Scala | apache-2.0 | 1,692 |
/*
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 not use this f... | mandar2812/DynaML | dynaml-core/src/main/scala/io/github/tailhq/dynaml/kernels/SVMKernelMatrix.scala | Scala | apache-2.0 | 1,938 |
package app.v1.api
import java.util.UUID.fromString
import app.db.NoteDatabase
import app.support.EmbeddedCassandraConnector
import app.v1.model.Note
import app.v1.service.{ CassandraNoteService, UUIDService }
import com.twitter.finagle.http.Status
import io.circe.generic.auto._
import io.finch.Input
import io.finch.... | PScopelliti/ProjectTracker | note-service/src/test/scala/app/v1/api/NoteApiTest.scala | Scala | apache-2.0 | 4,905 |
/** Copyright 2015 Dropbox, 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... | cross-language-cpp/djinni-generator | src/main/scala/djinni/CWrapperMarshal.scala | Scala | apache-2.0 | 15,204 |
package org.scalaide.core.internal.launching
import org.scalaide.core.IScalaPlugin
import org.scalaide.core.IScalaProject
import org.eclipse.core.resources.IResource
import org.eclipse.core.runtime.IStatus
import org.eclipse.core.runtime.Status
import org.scalaide.ui.internal.handlers.CompilerLaunchErrorHandler
import... | Kwestor/scala-ide | org.scala-ide.sdt.core/src/org/scalaide/core/internal/launching/MainClassVerifier.scala | Scala | bsd-3-clause | 2,786 |
/*
* 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 ... | godfreyhe/flink | flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/batch/BatchPhysicalRank.scala | Scala | apache-2.0 | 10,386 |
/*
* Copyright 2012 Tumblr 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... | chang2394/zipkin | zipkin-redis/src/main/scala/com/twitter/zipkin/storage/redis/RedisIndex.scala | Scala | apache-2.0 | 7,824 |
/* From Sereni, PhD thesis 2006 */
import stainless.lang._
object ToChurch {
def compose[T,U,V](f: U => V, g: T => U): T => V = {
(x: T) => f(g(x))
}
def id[T](x: T) = x
def succ(x: BigInt) = x + 1
def toChurch(n: BigInt, f: BigInt => BigInt): BigInt => BigInt = {
require(n >= 0)
if (n == 0)... | epfl-lara/stainless | frontends/benchmarks/termination/valid/ToChurch.scala | Scala | apache-2.0 | 468 |
/*
* Copyright 2014 Frugal Mechanic (http://frugalmechanic.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... | er1c/fm-http | src/main/scala/fm/http/server/DigestAuth.scala | Scala | apache-2.0 | 8,734 |
// scalastyle:off line.size.limit
/*
* Ported by Alistair Johnson from
* https://github.com/gwtproject/gwt/blob/master/user/test/com/google/gwt/emultest/java/math/BigIntegerCompareTest.java
*/
// scalastyle:on line.size.limit
package org.scalajs.testsuite.javalib.math
import java.math.BigInteger
import org.scalajs... | CapeSepias/scala-js | test-suite/src/test/scala/org/scalajs/testsuite/javalib/math/BigIntegerCompareTest.scala | Scala | bsd-3-clause | 14,412 |
/*
* Copyright 2013-2015 Websudos, Limited.
*
* 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 the above copyright notice,
* this list of c... | levinson/phantom | phantom-example/src/main/scala/com/websudos/phantom/example/basics/ExampleConnector.scala | Scala | bsd-2-clause | 4,200 |
package opjj
object ListUtil {
def reverse[A](list : List[A]) : List[A] = list match {
case head :: tail => reverse(tail) :+ head
case _ => Nil
}
}
| mbezjak/opjj-testing | 1-reverse-list/scala/src/main/scala/opjj/ListUtil.scala | Scala | mit | 174 |
/*
* Copyright (c) 2014-2020 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... | alexandru/monifu | monix-reactive/shared/src/main/scala/monix/reactive/internal/consumers/ForeachConsumer.scala | Scala | apache-2.0 | 1,879 |
package com.alvin.niagara.service
import akka.http.scaladsl.server.Directives._
import spray.json.DefaultJsonProtocol
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import com.alvin.niagara.dao.UserDAO.User
import com.alvin.niagara.dao.{CassandraDAO, UserDAO}
import com.alvin.niagara.model.RichPos... | AlvinCJin/Niagara | src/main/scala/com/alvin/niagara/service/Routes.scala | Scala | apache-2.0 | 2,374 |
package org.jetbrains.plugins.scala.annotator
import com.intellij.lang.annotation.AnnotationHolder
import org.jetbrains.plugins.scala.lang.psi.api.base.ScMethodLike
import org.jetbrains.plugins.scala.lang.psi.api.expr.ScFunctionExpr
import org.jetbrains.plugins.scala.lang.psi.api.statements.params.{ScClassParameter, S... | ilinum/intellij-scala | src/org/jetbrains/plugins/scala/annotator/ParametersAnnotator.scala | Scala | apache-2.0 | 2,654 |
package com.ambrosoft.bloom
import java.nio.ByteBuffer
import java.security.MessageDigest
import scala.collection.mutable
import scala.io.Source
/**
* Created by jacek on 3/4/16.
*/
/** Simple implementation of a mutable Bloom Filter as specified in
* http://codekata.com/kata/kata05-bloom-filters/
*
* St... | JacekAmbroziak/Ambrosoft | src/main/scala/com/ambrosoft/bloom/BloomFilter.scala | Scala | apache-2.0 | 2,862 |
/*
* Copyright 2017-2022 Viktor Lövgren
*
* SPDX-License-Identifier: MIT
*/
package ciris
import cats.{Eq, Show}
import cats.implicits._
import java.nio.charset.Charset
import java.nio.file.Path
/**
* Provides a description of a key used for loading configuration values.
*
* @example {{{
* scala> val api... | vlovgr/ciris | modules/core/src/main/scala/ciris/ConfigKey.scala | Scala | mit | 3,321 |
package com.rocketfuel.sdbc.cassandra
import com.datastax.oss.driver.api.core.`type`.DataType
import com.datastax.oss.driver.api.core.data.UdtValue
import com.datastax.oss.driver.api.core.metadata.token.Token
import com.rocketfuel.sdbc.base
import java.lang
import java.math.BigInteger
import java.net.InetAddress
impor... | rocketfuel/sdbc | cassandra/src/main/scala/com/rocketfuel/sdbc/cassandra/ParameterValue.scala | Scala | bsd-3-clause | 7,664 |
package com.twitter.finagle.kestrel.unit
import _root_.java.net.{InetSocketAddress, SocketAddress}
import _root_.java.nio.charset.Charset
import _root_.java.util.concurrent.{BlockingDeque, ExecutorService, Executors, LinkedBlockingDeque}
import com.google.common.cache.{CacheBuilder, CacheLoader, LoadingCache}
import ... | liamstewart/finagle | finagle-kestrel/src/test/scala/com/twitter/finagle/kestrel/unit/MultiReaderTest.scala | Scala | apache-2.0 | 19,323 |
package spray.json
import scala.util.Try
import scalaz._
import scalaz.Scalaz._
import spray.json.Scalaz._
import spray.json.DefaultJsonProtocol._
trait Formats {
implicit def maybeFormat[T: JsonFormat]: JsonFormat[Maybe[T]] =
optionFormat[T].xmap(Maybe.fromOption, _.toOption)
implicit def lazyOptionFormat[... | msimav/spray-contrib-scalaz | src/main/scala/spray/json/Formats.scala | Scala | mit | 1,394 |
package com.itszuvalex.itszulib.testing
import com.itszuvalex.itszulib.core.TileContainer
import net.minecraft.block.material.Material
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.World
/**
* Created by Christopher Harris (Itszuvalex) on 8/3/15.
*/
class BlockLocTrackerTest extends TileCont... | BlockWorker/ItszuLib | src/main/scala/com/itszuvalex/itszulib/testing/BlockLocTrackerTest.scala | Scala | gpl-2.0 | 457 |
package plugins
import _root_.services.HubNodeSubscriptionService
import play.api.{ Logger, Play, Application }
import play.api.Play.current
import models.{ OrganizationConfiguration, HubNode, Role }
import scala.collection.immutable.ListMap
import scala.util.matching.Regex
import play.api.mvc.Handler
import org.bson.... | delving/culture-hub | modules/hubNode/app/plugins/HubNodePlugin.scala | Scala | apache-2.0 | 5,376 |
package momijikawa.lacquer
import akka.actor.{ ActorRef, ActorRefFactory, Props }
import akka.io.Tcp.{ Aborted, Closed }
import momijikawa.lacquer.KanColleWebSocketServer.Push
import spray.can.websocket
import spray.can.websocket.FrameCommandFailed
import spray.can.websocket.frame.{ BinaryFrame, TextFrame }
import spr... | windymelt/lacquer | src/main/scala/momijikawa/lacquer/KanColleWebSocketWorker.scala | Scala | bsd-3-clause | 1,353 |
/*
* 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 ... | shaoxuan-wang/flink | flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/calcite/FlinkTypeSystem.scala | Scala | apache-2.0 | 5,687 |
package katas.scala.sieve
import org.junit.Test
import org.scalatest.Matchers
import scala.collection.mutable.ListBuffer
class SOE5 extends Matchers {
@Test def `find prime numbers`() {
primes().take(10) should equal(Seq(2, 3, 5, 7, 11, 13, 17, 19, 23, 29))
iteratorOfPrimes().take(10).toList should equal(Seq(2... | dkandalov/katas | scala/src/katas/scala/sieve/SOE5.scala | Scala | unlicense | 914 |
package effectful.examples.adapter.cats
import cats.{Applicative, Functor, Monoid}
import cats.data.WriterT
import effectful.Capture
import effectful.augments._
package object writer {
type LogWriterT[F[_],A] = WriterT[F,List[LogEntry],A]
object LogWriterT {
def construct[F[_],A](run: F[(List[LogEntry],A)]) ... | S-Mach/effectful | src/test/scala/effectful/examples/adapter/cats/writer/package.scala | Scala | mit | 1,158 |
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt._
object Dependencies {
//libs for testing
lazy val testing: Def.Initialize[Seq[ModuleID]] = Def.setting(Seq(
"org.scalatest" %%% "scalatest" % Versions.scalaTest % Test
))
//akka-related libs
lazy val akka = Def.setting(Seq(
"org.... | antonkulaga/threejs-facade | project/Dependencies.scala | Scala | mpl-2.0 | 1,730 |
package mesosphere.marathon
package core.storage.backup
import java.net.URI
import akka.Done
import akka.actor.ActorSystem
import akka.stream.Materializer
import com.typesafe.scalalogging.StrictLogging
import mesosphere.marathon.core.storage.backup.impl.PersistentStoreBackupImpl
import mesosphere.marathon.core.storag... | mesosphere/marathon | src/main/scala/mesosphere/marathon/core/storage/backup/PersistentStoreBackup.scala | Scala | apache-2.0 | 1,268 |
/*
* 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 ... | shaneknapp/spark | sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala | Scala | apache-2.0 | 26,380 |
package org.bitcoins.core.script.flag
import org.bitcoins.testkitcore.util.BitcoinSUnitTest
/** Created by chris on 4/6/16.
*/
class ScriptFlagUtilTest extends BitcoinSUnitTest {
"ScriptFlagUtil" must "check if strict der encoding check is required" in {
ScriptFlagUtil.requiresStrictDerEncoding(Seq(ScriptVer... | bitcoin-s/bitcoin-s | core-test/src/test/scala/org/bitcoins/core/script/flag/ScriptFlagUtilTest.scala | Scala | mit | 1,016 |
/*
* 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 ... | Panos-Bletsos/spark-cost-model-optimizer | core/src/test/scala/org/apache/spark/util/ClosureCleanerSuite.scala | Scala | apache-2.0 | 14,347 |
/*
package.scala
Shared code
*/
package object rd {
import smfsb._
import breeze.linalg.{Vector => BVec, _}
import breeze.numerics._
import scalafx.scene.image.WritableImage
import scalafx.scene.paint._
def toSfxI(im: PMatrix[DenseVector[Double]]): WritableImage = {
val wi = new WritableImage(im.c... | darrenjw/blog | reaction-diffusion/src/main/scala/rd/package.scala | Scala | apache-2.0 | 1,547 |
/*
* Copyright 2016 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... | ahudspith-equalexperts/ct-calculations | src/main/scala/uk/gov/hmrc/ct/ct600/v2/B43.scala | Scala | apache-2.0 | 1,284 |
import scala.io.Source
object AppendAndDelete extends App {
val lines = Source.stdin.getLines().toList
val s = lines(0)
val t = lines(1)
val k = lines(2).toInt
if(s == t) {
val appends = t.length
println(if(k - appends >= t.length) "Yes" else "No")
} else {
val commonPrefix = s.zip(t).takeWhil... | PaulNoth/hackerrank | contest/week_of_code_25/AppendAndDelete.scala | Scala | mit | 561 |
package controllers
import play.api.mvc._
import play.api.libs.concurrent.Akka
import actors.UserChannelsActor
import akka.actor.{ Props }
import scala.concurrent.duration._
import play.api.Play.current
import models.{ StartSearch, SearchFeed }
import play.api.libs.EventSource
import akka.pattern.ask
import akka.util.... | dbuschman7/collection-of-things | playground/app/controllers/Application.scala | Scala | apache-2.0 | 1,036 |
package de.mukis
import akka.actor.{ ActorSystem, Props, Actor, ActorLogging }
import scala.concurrent.duration._
import scala.language.postfixOps
class Pong extends Actor with ActorLogging {
def receive = {
case "Ping" =>
log.info( "Received Ping" )
sender ! "Pong"
}
}
class Ping extends Actor w... | muuki88/sbt-native-packager-examples | sbt-web-example/src/main/scala/de/mukis/Actors.scala | Scala | apache-2.0 | 770 |
package build.unstable.sonicd.source
import akka.actor.ActorContext
import build.unstable.sonic.model.{DataSource, Query, RequestContext}
import build.unstable.sonicd.SonicdLogging
import build.unstable.sonicd.source.SonicdSource._
import build.unstable.sonicd.system.actor.SonicdController._
import spray.json.JsonForm... | ernestrc/sonicd | server/src/main/scala/build/unstable/sonicd/source/SonicdSource.scala | Scala | mit | 1,137 |
package dsl
import ch.epfl.yinyang._
import ch.epfl.yinyang.typetransformers._
import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
package object la {
def la[T](block: => T): T = macro implementations.liftRep[T]
object implementations {
def liftRep[T](c: Context)(block: c.... | vjovanov/scala-yinyang | components/dsls/src/la/package.scala | Scala | bsd-3-clause | 764 |
package $organization$.$app_prefix$.lib
import org.scalatest.{FunSpec, Matchers}
class $app_prefix;format="Camel"$LibraryTest extends FunSpec with Matchers {
describe($app_prefix;format="Camel"$Library.getClass.getSimpleName){
it("should create message"){
val message = $app_prefix;format="Camel"$Library ... | x7c1/Slate | slate-template/src/main/g8/$app_prefix$-lib/src/test/scala/$organization__packaged$/$app_prefix__camel$/lib/$app_prefix__Camel$LibraryTest.scala | Scala | mit | 409 |
/*
* 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 ... | maropu/spark | core/src/main/scala/org/apache/spark/util/logging/DriverLogger.scala | Scala | apache-2.0 | 7,498 |
/*
* 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... | wzhongyuan/BigDL | spark/dl/src/main/scala/com/intel/analytics/bigdl/nn/quantized/QuantSerializer.scala | Scala | apache-2.0 | 3,976 |
/*
* Copyright (c) 2002-2018 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundatio... | HuangLS/neo4j | community/cypher/cypher-compiler-2.3/src/main/scala/org/neo4j/cypher/internal/compiler/v2_3/planner/logical/plans/DirectedRelationshipByIdSeek.scala | Scala | apache-2.0 | 1,645 |
package kornell.server.content
import java.io.InputStream
import java.util.logging.Logger
import com.amazonaws.HttpMethod
import com.amazonaws.auth.BasicAWSCredentials
import com.amazonaws.services.s3.AmazonS3Client
import com.amazonaws.services.s3.model.{DeleteObjectsRequest, GeneratePresignedUrlRequest, ObjectMetad... | Craftware/Kornell | kornell-api/src/main/scala/kornell/server/content/S3ContentManager.scala | Scala | apache-2.0 | 3,706 |
package net.sansa_stack.query.spark.ontop.kryo
import com.esotericsoftware.kryo.io.{Input, Output}
import com.esotericsoftware.kryo.{Kryo, Serializer}
import it.unibz.inf.ontop.model.`type`.TypeFactory
import net.sansa_stack.query.spark.ontop.OntopConnection
class TypeFactorySerializer(ontopSessionID: String)
exten... | SANSA-Stack/SANSA-RDF | sansa-query/sansa-query-spark/src/main/scala/net/sansa_stack/query/spark/ontop/kryo/TypeFactorySerializer.scala | Scala | apache-2.0 | 730 |
package bubblewrap
import org.scalatest.FlatSpec
import org.scalatest.Matchers.{be, convertToAnyShouldWrapper}
import TestUtils.{readAsBytes, readAsString}
class ContentSpec extends FlatSpec{
"Content" should "use the content encoding to encode the bytes back to string" in {
val koreanString = "동서게임 MS정품유선컨트롤... | ind9/bubblewrap | src/test/scala/bubblewrap/ContentSpec.scala | Scala | apache-2.0 | 2,784 |
package com.socrata.datacoordinator.id
import com.rojoma.json.v3.codec.{DecodeError, JsonDecode, JsonEncode}
import com.rojoma.json.v3.ast.{JValue, JNumber}
class RowVersion(val underlying: Long) extends AnyVal {
override def toString = s"RowVersion($underlying)"
}
object RowVersion {
implicit val jCodec = new J... | socrata-platform/data-coordinator | coordinatorlib/src/main/scala/com/socrata/datacoordinator/id/RowVersion.scala | Scala | apache-2.0 | 790 |
package scalacookbook.chapter09
import com.typesafe.scalalogging.slf4j.Logger
import org.slf4j.LoggerFactory
/**
* Created by liguodong on 2016/7/23.
*/
object Main extends App{
val logger = Logger(LoggerFactory.getLogger(Main.getClass))
logger.info("This is very convenient...")
val a=0
val b=11
val ... | liguodongIOT/java-scala-mix-sbt | src/main/scala/scalacookbook/chapter09/Main.scala | Scala | apache-2.0 | 479 |
/*
* 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 | examples/src/main/scala/org/apache/spark/examples/BroadcastTest.scala | Scala | apache-2.0 | 2,361 |
/*
* Copyright (C) 2017 Michael Dippery <[email protected]>
*
* 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/math/Numeric.scala | Scala | apache-2.0 | 2,793 |
package com.philipborg.mummu.image.scaling
import java.util.concurrent.Callable
import com.philipborg.mummu.image.Image
trait Scaler extends Callable[Image] {
} | philipborg/Mummu | src/main/scala/com/philipborg/mummu/image/scaling/Scaler.scala | Scala | agpl-3.0 | 164 |
package org.scalaide.debug.internal.model
import org.eclipse.debug.core.DebugPlugin
import org.junit.Assert._
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.mockito.Mockito._
import com.sun.jdi.ThreadReference
import com.sun.jdi.ThreadGroupReference
import com.sun.jdi.StringReference
... | scala-ide/scala-ide | org.scala-ide.sdt.debug.tests/src/org/scalaide/debug/internal/model/ScalaDebugModelPresentationTest.scala | Scala | bsd-3-clause | 5,310 |
package security
import play.api.Application
import play.api.data.Form
import play.api.mvc.Request
import play.api.templates.Html
import securesocial.controllers.DefaultTemplatesPlugin
class DefaultTemplates(application: Application) extends DefaultTemplatesPlugin(application)
{
/**
* Returns the html for the lo... | lukaszbudnik/hackaton-portal | app/security/DefaultTemplates.scala | Scala | apache-2.0 | 600 |
/*
* Copyright (c) <2013>, Amanj Sherwany <http://www.amanj.me>
* All rights reserved.
* */
package ch.usi.inf.l3.piuma.plugin
import transformers._
import ch.usi.inf.l3.piuma.util._
import scala.tools.nsc.transform.TypingTransformers
import scala.tools.nsc.ast.TreeDSL
import scala.tools.nsc.transform.Transform
imp... | amanjpro/piuma | piuma/src/main/scala/ch/usi/inf/l3/piuma/plugin/TransformerPluginComponent.scala | Scala | bsd-3-clause | 2,212 |
// Copyright (C) 2009 The Android Open Source Project
//
// 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 ... | gkossakowski/gimd | src/main/scala/com/google/gimd/jgit/JGitBranch.scala | Scala | apache-2.0 | 1,189 |
/*
* MUSIT is a museum database to archive natural and cultural history data.
* Copyright (C) 2016 MUSIT Norway, part of www.uio.no (University of Oslo)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Softw... | kpmeen/musit | musit-service/src/test/scala/no/uio/musit/security/crypto/MusitCryptoSpec.scala | Scala | gpl-2.0 | 1,510 |
package org.apache.spark.repl
import scala.reflect._
import scala.reflect.api.{Mirror, Universe, TypeCreator}
import scala.tools.nsc.{io, Properties, Settings, interpreter}
import scala.tools.nsc.interpreter._
import scala.tools.nsc.util.ScalaClassLoader._
import scala.reflect.api.{Mirror, TypeCreator, Universe => Api... | andypetrella/spark-notebook | modules/spark/src/main/scala_2.11/spark-last/HackSparkILoop.scala | Scala | apache-2.0 | 1,832 |
package pl.gigiel.seldon
object Const {
type Coordinate = Long
def coordinate(a: Long): Option[Const.Coordinate] = Option(a)
}
| tomaszacer/seldon | src/main/scala/pl/gigiel/seldon/Const.scala | Scala | apache-2.0 | 138 |
package java.io
abstract class OutputStream extends Object with Closeable with Flushable {
def close() {}
def flush() {}
def write(b: Array[Byte]) {
write(b, 0, b.length)
}
def write(b: Array[Byte], off: Int, len: Int) {
var n = off;
val stop = off+len
while (n < stop) {
write(b(n))
... | swhgoon/scala-js | javalib/source/src/java/io/OutputStream.scala | Scala | bsd-3-clause | 373 |
package controllers.s_care_you_provide
import controllers.ClaimScenarioFactory
import org.specs2.mutable._
import utils.WithJsBrowser
import utils.pageobjects.PageObjects
import utils.pageobjects.s_care_you_provide.GTheirPersonalDetailsPage
class GTheirPersonalDetailsErrorSpec extends Specification {
section("integ... | Department-for-Work-and-Pensions/ClaimCapture | c3/test/controllers/s_care_you_provide/GTheirPersonalDetailsErrorSpec.scala | Scala | mit | 3,187 |
package com.philipborg.mummu.io
import java.io.InputStream
import java.io.OutputStream
import org.apache.commons.vfs2.FileObject
import org.apache.commons.vfs2.VFS
class WebDavResolver(username: String, password: String, hostname: String, port: Int) extends PathResolver {
protected val fsMan = VFS.getManager;
p... | philipborg/Mummu | src/main/scala/com/philipborg/mummu/io/WebDavResolver.scala | Scala | agpl-3.0 | 1,296 |
package mesosphere.raml.backend.treehugger
import mesosphere.raml.backend.{PlayJson, PlayJsNumber, PlayJsValue, PlayJsString, PLAY_JSON_FORMAT, PLAY_JSON_RESULT}
import mesosphere.raml.ir.{StringT, UnionT, NumberT}
import treehugger.forest._
import definitions._
import treehuggerDSL._
object UnionVisitor {
def vi... | mesosphere/marathon | type-generator/src/main/scala/mesosphere/raml/backend/treehugger/UnionVisitor.scala | Scala | apache-2.0 | 5,086 |
package org.lolhens.renderengine.vector
final case class Vector3l private(override val x: Long,
override val y: Long,
override val z: Long) extends Vector3[Long](x, y, z) {
override type Self = Vector3l
override def Vector3(x: Long, y: Long, z: L... | LolHens/LibRenderEngine | src/main/scala/org/lolhens/renderengine/vector/Vector3l.scala | Scala | gpl-2.0 | 1,645 |
package at.forsyte.apalache.tla.lir.storage
import at.forsyte.apalache.tla.lir.NameEx
import at.forsyte.apalache.tla.lir.convenience.tla
import org.junit.runner.RunWith
import org.scalatest.{BeforeAndAfterEach, FunSuite}
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class TestChangeListener e... | konnov/apalache | tlair/src/test/scala/at/forsyte/apalache/tla/lir/storage/TestChangeListener.scala | Scala | apache-2.0 | 2,619 |
package moveRefactoring.container
import moveRefactoring.bar.O.m1
object ObjUser {
def main(args: Array[String]) {
m1()
}
} | whorbowicz/intellij-scala | testdata/move/scl4621/after/moveRefactoring/container/ObjUser.scala | Scala | apache-2.0 | 133 |
package org.psliwa.idea.composerJson.intellij.codeAssist.composer
import com.intellij.codeInsight.intention.IntentionAction
import com.intellij.json.psi._
import com.intellij.lang.annotation.{AnnotationHolder, Annotator, HighlightSeverity}
import com.intellij.openapi.application.ApplicationManager
import com.intellij.... | psliwa/idea-composer-plugin | src/main/scala/org/psliwa/idea/composerJson/intellij/codeAssist/composer/PackageVersionAnnotator.scala | Scala | mit | 11,332 |
/*
* Copyright 2015 ligaDATA
*
* 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 ... | traytonwhite/Kamanja | trunk/Pmml/PmmlCompiler/src/main/scala/com/ligadata/pmml/transforms/printers/scala/common/SimpleSetPredicateCodePrinter.scala | Scala | apache-2.0 | 3,369 |
package lambdacart.util.typealigned
import scalaz.Leibniz
import scalaz.Leibniz.===
/**
* Isomorphic to `AOption[λ[(α, β) => APair[F[α, ?], G[?, β]]], A, B]`,
* but avoids allocating an `APair` instance.
*/
sealed abstract class AOption2[F[_, _], G[_, _], A, B]
case class ASome2[F[_, _], G[_, _], A, X, B](f: F[A,... | TomasMikula/LambdaCart | src/main/scala/lambdacart/util/typealigned/AOption2.scala | Scala | apache-2.0 | 1,539 |
package me.heaton.profun.week2
import scala.annotation.tailrec
object TailRecursion {
@tailrec
def gcd(a: Int, b: Int): Int =
if (b == 0) a else gcd(b, a % b)
def factorial(n: Int): Int =
if (n == 0) 1 else n * factorial(n - 1)
def tailFactorial(n: Int): Int = {
@tailrec
def loop(acc: Int,... | heaton/hello-scala | src/main/scala/me/heaton/profun/week2/TailRecursion.scala | Scala | mit | 406 |
package sgl.geometry
/** an AABB Rect.
*
* This class is mutable, and several of its methods modify the state instead
* of just returning a new Rect. This is very much not idiomatic Scala (which
* favors immutable objects), but this is also a trade-off necessary for games
* to avoid generating too much garba... | regb/scala-game-library | core/src/main/scala/sgl/geometry/Rect.scala | Scala | mit | 1,979 |
/*!
* Copyright 2013-2014 Dennis Hörsch.
*
* 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... | dhs3000/dropwizard-scala | src/test/scala/de/dennishoersch/util/json/JsonTest.scala | Scala | apache-2.0 | 1,428 |
package scala.collection.scalatest.mutable
import org.scalatest._
trait MutableBagBehaviours {
this: FlatSpec =>
def mutableBagBehaviour[A](bag: => scala.collection.mutable.Bag[A]) {
it should "support removing single elements with -=" in {
val b = bag
var expectedSize = b.size
for (elem <... | sageserpent-open/multisets | src/test/scala/scala/collection/scalatest/mutable/MutableBagBehaviours.scala | Scala | bsd-3-clause | 1,819 |
package thurloe.service
import org.broadinstitute.dsde.rawls.model.{RawlsUserEmail, RawlsUserSubjectId}
import org.broadinstitute.dsde.rawls.model.UserModelJsonSupport.{RawlsUserSubjectIdFormat, RawlsUserEmailFormat}
import spray.json.DefaultJsonProtocol
import scala.language.postfixOps
object ApiDataModelsJsonProto... | broadinstitute/thurloe | src/main/scala/thurloe/service/ApiDataModels.scala | Scala | bsd-3-clause | 2,743 |
package uk.gov.dvla.vdl.report.pdf
import java.io.InputStream
import java.util.Date
import org.scalatest.{FlatSpec, Matchers}
import uk.gov.dvla.vdl.report.JsonReport
import uk.gov.dvla.vdl.report.exception.NoCompiledTemplateException
import scala.io.Source.fromFile
class GeneratorTest extends FlatSpec with Matcher... | dvla/pdf-generator | src/test/scala/uk/gov/dvla/vdl/report/pdf/GeneratorTest.scala | Scala | mit | 2,539 |
package com.github.agaro1121.marshalling
import io.circe.{Decoder, Encoder, HCursor}
import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.syntax._
import com.github.agaro1121.models.pvpmatches.{PvpMatch, PvpMatches}
trait PvpMatchesMarshalling {
implicit protected lazy val PvpMatchDecode... | agaro1121/PathOfExileApiClient | src/main/scala/com/github/agaro1121/marshalling/PvpMatchesMarshalling.scala | Scala | mit | 705 |
package org.jetbrains.plugins.scala.lang.psi.types.api
import org.jetbrains.plugins.scala.lang.psi.types.nonvalue.NonValueType
import org.jetbrains.plugins.scala.lang.psi.types.{ScType, ScUndefinedSubstitutor}
import org.jetbrains.plugins.scala.project.ProjectContext
/**
* Use this type if you want to resolve gener... | loskutov/intellij-scala | src/org/jetbrains/plugins/scala/lang/psi/types/api/UndefinedType.scala | Scala | apache-2.0 | 1,485 |
/* Title: Pure/System/interrupt.scala
Author: Makarius
Support for POSIX interrupts (bypassed on Windows).
*/
package isabelle
import sun.misc.{Signal, SignalHandler}
object POSIX_Interrupt
{
def handler[A](h: => Unit)(e: => A): A =
{
val SIGINT = new Signal("INT")
val new_handler = new ... | MerelyAPseudonym/isabelle | src/Pure/System/posix_interrupt.scala | Scala | bsd-3-clause | 610 |
package utils
import javax.inject.Inject
import play.api.http.HttpFilters
import play.api.mvc.EssentialFilter
import play.filters.csrf.CSRFFilter
import play.filters.headers.SecurityHeadersFilter
/**
* Provides filters.
*/
class Filters @Inject()(csrfFilter: CSRFFilter, securityHeadersFilter: SecurityHeadersFilter... | agoetschm/linkmanager | server/app/utils/Filters.scala | Scala | gpl-3.0 | 432 |
package sbt
import org.scalacheck._
import Gen.{listOf}
import Prop.forAll
import Tags._
object TagsTest extends Properties("Tags")
{
def tagMap: Gen[TagMap] = for(ts <- listOf(tagAndFrequency)) yield ts.toMap
def tagAndFrequency: Gen[(Tag, Int)] = for(t <- tag; count <- Arbitrary.arbitrary[Int]) yield (t, count)
... | harrah/xsbt | main/src/test/scala/TagsTest.scala | Scala | bsd-3-clause | 1,126 |
/* __ *\\
** ________ ___ / / ___ __ ____ PhantomJS support for Scala.js **
** / __/ __// _ | / / / _ | __ / // __/ (c) 2013-2017, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ |/_// /_\\ \\ https://www.scala-js.org/ **... | sjrd/scala-js-env-phantomjs | phantomjs-sbt-plugin/src/main/scala/org/scalajs/jsenv/phantomjs/sbtplugin/PhantomJSEnvPlugin.scala | Scala | bsd-3-clause | 4,298 |
/*
* 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 ... | graphframes/graphframes | src/test/scala/org/graphframes/lib/StronglyConnectedComponentsSuite.scala | Scala | apache-2.0 | 1,760 |
package com.twitter.finagle.netty3.http
import org.jboss.netty.handler.codec.http.{DefaultHttpResponse, HttpResponseStatus, HttpVersion}
private[finagle] object OneHundredContinueResponse
extends DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE)
| mkhq/finagle | finagle-netty3-http/src/main/scala/com/twitter/finagle/netty3/http/OneHundredContinueResponse.scala | Scala | apache-2.0 | 273 |
/*
* Copyright 2001-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 agre... | travisbrown/scalatest | src/test/scala/org/scalatest/exceptions/StackDepthExceptionSpec.scala | Scala | apache-2.0 | 4,905 |
// Test that we don't track variables which is referred in another closure.
object VarRef {
locally {
var x: String|Null = ???
val y = {
if (x != null) {
val _: String = x // ok: y doesn't create closure
}
}
if (x != null) {
val a: String = x // ok
}
}
locally {
... | som-snytt/dotty | tests/explicit-nulls/neg/var-ref-in-closure.scala | Scala | apache-2.0 | 3,227 |
package java.io
trait DataInput {
def readBoolean(): Boolean
def readByte(): Byte
def readChar(): Char
def readDouble(): Double
def readFloat(): Float
def readFully(b: Array[Byte]): Unit
def readFully(b: Array[Byte], off: Int, len: Int): Unit
def readInt(): Int
def readLine(): String
def readLong()... | colinrgodsey/scala-js | javalib/src/main/scala/java/io/DataInput.scala | Scala | bsd-3-clause | 468 |
package re.infrastructure
case class AppPostfix(str: String) {
import AppPostfix._
def isSnapshot = str.equals(snapshotStr)
private val maxPostfixLength = 100
def validate = str match {
case correct if correct.length < maxPostfixLength => true
case _ => false
}
}
object AppPostfix {
val snaps... | Vlad187/sandbox | src/main/scala/re/infrastructure/AppPostfix.scala | Scala | apache-2.0 | 342 |
package com.getjenny.starchat.services.esclient
/**
* Created by Angelo Leto <[email protected]> on 14/11/17.
*/
object InstanceRegistryElasticClient extends SystemElasticClient {
override val indexSuffix: String = config.getString("es.system_instance_registry_suffix")
// decision table changes awareness per... | GetJenny/starchat | src/main/scala/com/getjenny/starchat/services/esclient/InstanceRegistryElasticClient.scala | Scala | gpl-2.0 | 644 |
/*
* Copyright 2012-2013 Stephane Godbillon (@sgodbillon)
*
* 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 appl... | fr3akX/Play-ReactiveMongo | src/main/scala/play/modules/reactivemongo/json.scala | Scala | apache-2.0 | 16,333 |
package scoverage
import org.scalatest.{BeforeAndAfter, FunSuite, OneInstancePerTest}
/** @author Stephen Samuel */
class CoverageTest extends FunSuite with BeforeAndAfter with OneInstancePerTest {
test("coverage for no statements is 1") {
val coverage = Coverage()
assert(1.0 === coverage.statementCoverage... | rorygraves/scalac-scoverage-plugin | scalac-scoverage-plugin/src/test/scala/scoverage/CoverageTest.scala | Scala | apache-2.0 | 1,156 |
/*
* 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 n... | guozhangwang/kafka | streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KGroupedStream.scala | Scala | apache-2.0 | 9,239 |
/*
Copyright 2013 Twitter, 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 in writing, software... | nvoron23/summingbird | summingbird-scalding/src/main/scala/com/twitter/summingbird/scalding/service/EmptyService.scala | Scala | apache-2.0 | 894 |
package org.jetbrains.plugins.scala
package codeInspection.collections
import org.jetbrains.plugins.scala.codeInspection.InspectionBundle
import org.jetbrains.plugins.scala.codeInspection.collections.OperationOnCollectionsUtil._
import org.jetbrains.plugins.scala.lang.psi.api.expr.{ScMethodCall, ScExpression}
import o... | consulo/consulo-scala | src/org/jetbrains/plugins/scala/codeInspection/collections/MapGetOrElseInspection.scala | Scala | apache-2.0 | 2,811 |
/*
* Copyright University of Basel, Graphics and Vision Research Group
*
* 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 ... | unibas-gravis/scalismo-faces | src/main/scala/scalismo/faces/render/BRDF.scala | Scala | apache-2.0 | 915 |
package ru.mipt.acsl.geotarget.web
import scala.scalajs.js.JSApp
import scala.scalajs.js.Dynamic.{global => g}
/**
* @author Artem Shein
*/
object GeoTargetWebJsApp extends JSApp {
def main(): Unit = {
println("Hello, JS world!")
g.alert("Scala.JS works fine, dude!")
}
}
| acsl-mipt/geo-target | geo-target-web/src/main/scala/ru/mipt/acsl/geotarget/web/GeoTargetWebJsApp.scala | Scala | mit | 290 |
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.