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 models.core
import controllers.common.JSONWrites._
import play.api.libs.json.Json
class TemporalProfile(data: Seq[(Int, Int)]) {
val histogram = data.foldLeft(scala.collection.mutable.Map.empty[Int, Int]) { case (h, (nextStart, nextEnd)) =>
Seq.range(nextStart, nextEnd + 1).foreach(year => h.put(year... | pelagios/peripleo | app/models/core/TemporalProfile.scala | Scala | gpl-3.0 | 606 |
package controller
import controller.impl.mode.ModeEnum.ModeEnum
import model.FieldTrait
import util.position.Position
trait ControllerTrait {
def changePlayer: String
def moveTile(posFrom: Position, posTo: Position): List[String]
def moveTileUndo(): List[String]
def getFieldAsString: String
def setMode... | MartinLei/Arimaa | src/main/scala/controller/ControllerTrait.scala | Scala | mit | 392 |
package util
object Util {
lazy val filteredUsernames = Seq("jenkins", "gerrit", "gerrit2")
def topAuthorUsernames(amount: Int, authors: Seq[String]): Seq[String] = {
authors.groupBy(auth => auth).mapValues(_.size).toSeq.
sortBy(_._2)(Ordering[Int].reverse).take(amount).map(_._1).diff(filteredUsernames)
... | grahamar/Giles | app/util/Util.scala | Scala | apache-2.0 | 1,500 |
//package ch.wsl.box.rest
//
//import ch.wsl.box.model.shared.JSONField
//import org.junit.runner.RunWith
//
//
//class FormServiceSpec extends BaseSpec {
//
//
// "Form masks" should {
//
// "return the available form list" in {
// get(endpoint + "/form") {
// responseAs[Seq[String]] === Seq("test_form... | Insubric/box | server/src/test/scala/ch/wsl/box/rest/routes/FormServiceSpec.scala | Scala | apache-2.0 | 576 |
@deprecated("Suppress warnings", since="2.11")
object Test extends App {
class X[T: ClassManifest] {
val a = Array.ofDim[T](3, 4)
}
val x = new X[String]
x.a(1)(2) = "hello"
assert(x.a(1)(2) == "hello")
}
| felixmulder/scala | test/files/run/t0677-old.scala | Scala | bsd-3-clause | 221 |
package org.jetbrains.plugins.scala
package overrideImplement
import com.intellij.codeInsight.generation.{GenerateMembersUtil, ClassMember => JClassMember}
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intelli... | loskutov/intellij-scala | src/org/jetbrains/plugins/scala/overrideImplement/ScalaOIUtil.scala | Scala | apache-2.0 | 12,085 |
package net.liftweb.markdown
/*
* Copyright 2013 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
*
* U... | lzpfmh/framework-2 | core/markdown/src/test/scala/net/liftweb/markdown/TransformerTest.scala | Scala | apache-2.0 | 8,957 |
/*
* 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... | liquidarmour/ct-calculations | src/test/scala/uk/gov/hmrc/ct/accounts/frs105/boxes/AC491Spec.scala | Scala | apache-2.0 | 5,560 |
package rs.fon.kvizic.networkAnalysis.algorithm.centrality
import rs.fon.kvizic.networkAnalysis.Network
import rs.fon.kvizic.networkAnalysis.algorithm.shortestPath.ShortestPath
import rs.fon.kvizic.networkAnalysis.Actor
class Centrality(shortestPath: ShortestPath) {
lazy val shortestPaths = shortestPath.getPaths
... | dpavkov/network-analysis-metrics | src/main/scala/rs/fon/kvizic/networkAnalysis/algorithm/centrality/Centrality.scala | Scala | mit | 1,112 |
import scala.io.Source
if (args.length > 0){
for (line <- Source.fromFile(args(0)).getLines() ) {
println(line.length + " " + line)
}
def widthOfLenght(s: String): s.length.toString.length
val list = Source.fromFile(args(0)).getLines().toList()
val longestLine = list.reduceLeft( (a, b) ... | Mistobaan/cracking-the-code-interview | src/scala/Scala Book/Step12.scala | Scala | mit | 470 |
package com.twitter.service.cachet.limiter
import javax.servlet.http.HttpServletRequest
trait LimitingService {
def isUnderLimit(request: HttpServletRequest): Boolean
} | nkallen/cachet | src/main/scala/com/twitter/service/cachet/limiter/LimitingService.scala | Scala | mit | 172 |
/* sbt -- Simple Build Tool
* Copyright 2008, 2009 Steven Blundy, Mark Harrah
*/
package sbt
import testing.{ Logger => TLogger, Event => TEvent, Status => TStatus }
trait TestReportListener {
/** called for each class or equivalent grouping */
def startGroup(name: String)
/** called for each test method or... | jaceklaskowski/sbt | testing/src/main/scala/sbt/TestReportListener.scala | Scala | bsd-3-clause | 4,892 |
/*
* 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/main/scala/org/scalatest/EitherValues.scala | Scala | apache-2.0 | 7,279 |
object Topic3DataAbstraction {
class Rational(num:Int, denom:Int) {
require(denom!=0, "denominator must be non-zero") //also assert(denom!=0)
// normalize values as soon as possible to avoid arithmetic overflows
val g = gcd(num,denom)
val numerator = num/g
val denominator = denom/g
... | rominavarela-scala/progfun1 | progfun1-week2/src/Topic3DataAbstraction.scala | Scala | mit | 1,754 |
package morph.parser
import org.scalatest.FunSuite
import morph.ast._
import morph.ast.Implicits._
class CsvParserSuite extends FunSuite {
// to make testing easier
val A = ArrayNode
val C = CsvParser
test("parse single element csv with no quotes") {
val csv = "test"
val ast = A(A("test"))
asse... | anishathalye/morph | src/test/scala/morph/parser/CsvParserSuite.scala | Scala | mit | 1,493 |
package edu.gemini.ags.conf
import edu.gemini.ags.api.AgsMagnitude.MagnitudeCalc
import edu.gemini.catalog.api._
import edu.gemini.spModel.core.{BandsList, MagnitudeBand}
import edu.gemini.spModel.gemini.obscomp.SPSiteQuality.Conditions
import edu.gemini.spModel.guide.GuideSpeed
import scalaz._
import Scalaz._
/**
... | spakzad/ocs | bundle/edu.gemini.ags/src/main/scala/edu/gemini/ags/conf/ProbeLimitsCalc.scala | Scala | bsd-3-clause | 976 |
/*
* 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 ... | u2009cf/spark-radar | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/ExternalCatalog.scala | Scala | apache-2.0 | 9,511 |
/*
* 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 ... | sryza/spark | streaming/src/main/scala/org/apache/spark/streaming/dstream/InputDStream.scala | Scala | apache-2.0 | 3,136 |
package json2caseclass.implementation
import java.util.regex.Pattern
import json2caseclass.model
import json2caseclass.model.Schema._
import json2caseclass.model.Types.Suffix
object NameTransformer {
def apply(suffix: Suffix): model.NameTransformer = model.NameTransformer(
NameTransformer.makeSafeCamelCaseCase... | battermann/sbt-json | src/main/scala/json2caseclass/implementation/NameTransformer.scala | Scala | mit | 2,331 |
package bylt.core
import org.scalacheck.Gen
/**
* Created by attila on 4/14/2016.
*/
object ArbitraryModule {
def declGen (depth : Int) : Gen [Declaration] = {
for {
tpe <- Gen.option (ArbitraryType.typeExprGen (depth))
value <- Gen.option (ArbitraryExpr.exprGen (depth))
... | ozmi/bylt | src/test/scala/bylt/core/ArbitraryModule.scala | Scala | mit | 1,376 |
package dotty.tools.dotc
package transform
import dotty.tools.dotc.transform.TreeTransforms.{TransformerInfo, TreeTransform, TreeTransformer}
import dotty.tools.dotc.ast.{Trees, tpd}
import scala.collection.{ mutable, immutable }
import ValueClasses._
import scala.annotation.tailrec
import core._
import typer.ErrorRep... | folone/dotty | src/dotty/tools/dotc/transform/PostTyper.scala | Scala | bsd-3-clause | 6,514 |
/*
* Copyright 2022 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/iht-frontend | app/iht/utils/PropertyAndMortgageHelper.scala | Scala | apache-2.0 | 3,816 |
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/
package scala.collection.mutab... | martijnhoekstra/scala | src/library/scala/collection/mutable/Iterable.scala | Scala | apache-2.0 | 1,029 |
package org.cloudio.morpheus.ontouml
import java.text.SimpleDateFormat
import java.util.Date
import java.util.concurrent.TimeUnit
import org.morpheus.Morpheus._
import org.morpheus._
/**
* Created by zslajchrt on 23/04/16.
*/
object Entities {
}
@fragment
trait Brain {
}
@fragment
trait Heart {
}
trait Per... | zslajchrt/morpheus-tutor | src/main/scala/org/cloudio/morpheus/ontouml/Entities.scala | Scala | apache-2.0 | 6,674 |
/***********************************************************************
* Copyright (c) 2013-2020 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... | aheyne/geomesa | geomesa-fs/geomesa-fs-storage/geomesa-fs-storage-parquet/src/main/scala/org/locationtech/geomesa/parquet/io/SimpleFeatureParquetSchemaV0.scala | Scala | apache-2.0 | 3,970 |
package com.twitter.finagle.buoyant.h2
import java.util.concurrent.atomic.AtomicBoolean
import com.twitter.concurrent.AsyncQueue
import com.twitter.finagle.buoyant.h2.BufferedStream.{RefCountedDataFrame, RefCountedFrame, RefCountedTrailersFrame, State}
import com.twitter.finagle.buoyant.h2.Stream.AsyncQueueReader
impo... | linkerd/linkerd | finagle/h2/src/main/scala/com/twitter/finagle/buoyant/h2/BufferedStream.scala | Scala | apache-2.0 | 9,129 |
package com.twitter.finagle.ssl
import java.net.Socket
import java.security.cert.X509Certificate
import javax.net.ssl.{SSLEngine, X509ExtendedTrustManager}
/**
* A trust manager that does not validate anything.
*/
private[ssl] class IgnorantTrustManager extends X509ExtendedTrustManager {
def getAcceptedIssuers():... | luciferous/finagle | finagle-core/src/main/scala/com/twitter/finagle/ssl/IgnorantTrustManager.scala | Scala | apache-2.0 | 1,110 |
/*============================================================================
This Chisel source file is part of a pre-release version of the HardFloat IEEE
Floating-Point Arithmetic Package, by John R. Hauser (with some contributions
from Yunsup Lee and Andrew Waterman, mainly concerning testing).
Copyright 2010, ... | stanford-ppl/spatial-lang | spatial/core/resources/chiselgen/template-level/templates/hardfloat/rawFloatFromFN.scala | Scala | mit | 3,189 |
/*
* Copyright (c) 2014 Robert Conrad - All Rights Reserved.
* Unauthorized copying of this file, via any medium is strictly prohibited.
* This file is proprietary and confidential.
* Last modified by rconrad, 12/24/14 4:37 PM
*/
package base.common.logging
import base.common.random.RandomService
import com.goog... | robconrad/base-api | project-common/src/main/scala/base/common/logging/LoggerToken.scala | Scala | mit | 587 |
package pl.japila.servicediscovery
import org.specs2._
class ServiceDiscoveryServerAppSpec extends Specification { def is = s2"""
This is a specification to check the 'Hello world' string
The 'Hello world' string should
contain 11 characters $e1
start with 'Hello' ... | jaceklaskowski/curator-x-discovery-spray-scala | src/test/scala/pl/japila/servicediscovery/ServiceDiscoveryServerAppSpec.scala | Scala | apache-2.0 | 616 |
package org.scalajs.sbtplugin.test
object Main {
def main(args: Array[String]): Unit = {
println("Hello world")
}
}
| scala-js/scala-js | sbt-plugin/src/sbt-test/settings/legacy-link-tasks/Main.scala | Scala | apache-2.0 | 125 |
package epic.sequences
import java.io._
import breeze.config.{CommandLineParser, Configuration}
import breeze.optimize.FirstOrderMinimizer.OptParams
import com.typesafe.scalalogging.slf4j.LazyLogging
import epic.trees.{AnnotatedLabel, ProcessedTreebank}
/**
*
* @author dlwh
*/
object TrainPosTagger extends LazyLo... | jovilius/epic | src/main/scala/epic/sequences/TrainPosTagger.scala | Scala | apache-2.0 | 2,152 |
/*
* Copyright (c) 2013-2014 Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0, and
* you may not use this file except in compliance with the Apache License
* Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
* http://www.... | jramos/snowplow | 2-collectors/scala-stream-collector/src/main/scala/com.snowplowanalytics.snowplow.collectors/scalastream/ScalaCollectorApp.scala | Scala | apache-2.0 | 6,225 |
package euler
/**
* If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
*
* Find the sum of all the multiples of 3 or 5 below 1000.
*/
class Problem1 extends Problem(1) {
def solve: Any = (1 to 1000).filter(x => x % 3 == 0 || x % 5 == ... | ygunayer/euler | src/test/scala/euler/Problems1-10.scala | Scala | unlicense | 6,348 |
package io.scalajs.nodejs
import io.scalajs.nodejs.buffer.Buffer
import io.scalajs.util.PromiseHelper._
import scala.concurrent.Future
import scala.scalajs.js
/**
* net package object
*/
package object net {
/**
* net.Server Events
* @param server the given [[Server server]]
*/
implicit class Se... | scalajs-io/nodejs | app/common/src/main/scala/io/scalajs/nodejs/net/package.scala | Scala | apache-2.0 | 6,020 |
package com.bloomberg.sparkflow.serialization
import org.scalatest.{ShouldMatchers, FunSuite}
/**
* Created by ngoehausen on 4/18/16.
*/
class ClassExplorationTest extends FunSuite with ShouldMatchers {
test("basic class explore"){
val evenMoreNested = (x: Int) => x + 7
val nested = (x: Int) => evenMo... | nimbusgo/spark-flow | src/test/scala/com/bloomberg/sparkflow/serialization/ClassExplorationTest.scala | Scala | apache-2.0 | 1,024 |
package com.arcusys.valamis.web.service
import javax.servlet.http.{HttpServletRequest, HttpServletResponse}
import com.arcusys.learn.liferay.LiferayClasses._
import com.arcusys.learn.liferay.util.ParamUtilHelper
class OpenCertificateAction extends LBaseStrutsAction {
override def execute(originalStrutsAction: LSt... | arcusys/Valamis | valamis-portlets/src/main/scala/com/arcusys/valamis/web/service/OpenCertificateAction.scala | Scala | gpl-3.0 | 761 |
/*
* 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 ... | lenovor/zen | ml/src/test/scala/com/github/cloudml/zen/ml/neuralNetwork/StackedRBMSuite.scala | Scala | apache-2.0 | 1,269 |
package com.jejking.rprng.api
class LottoGames {
}
| jejking/rprng | src/main/scala/com/jejking/rprng/api/LottoGames.scala | Scala | apache-2.0 | 53 |
package ohnosequences.bio4j.bundles
import shapeless._
import shapeless.ops.hlist._
import ohnosequences.typesets._
import ohnosequences.statika._
import ohnosequences.statika.aws._
import ohnosequences.statika.ami._
import ohnosequences.bio4j.statika._
import ohnosequences.awstools.s3._
import ohnosequences.awstools.... | bio4j/enzymedb-module | src/main/scala/EnzymeDB.scala | Scala | agpl-3.0 | 2,123 |
package ml.combust.mleap.runtime.transformer.feature
import ml.combust.mleap.core.feature.VectorSlicerModel
import ml.combust.mleap.core.types._
import org.scalatest.FunSpec
class VectorSlicerSpec extends FunSpec {
describe("input/output schema") {
it("has the correct inputs and outputs") {
val transform... | combust/mleap | mleap-runtime/src/test/scala/ml/combust/mleap/runtime/transformer/feature/VectorSlicerSpec.scala | Scala | apache-2.0 | 602 |
trait Base {
def t = 1
def t(n: Int) = n
def bt = 2
def bt(n: Int) = n
}
trait Derived extends Base {
// was: double definition error
override def t = 1 + super.t
override def t(n: Int) = 1 + super.t(n)
override def bt = 1 + super.bt
override def bt(n: Int) = 1 + su... | scala/scala | test/files/run/t8010.scala | Scala | apache-2.0 | 563 |
import java.io.File
/**
* @define PP This class is an instance of XXX so its members are not called directly.
* Instead these classes are instantiated via a driver's ''process''. See YYY for more details. */
abstract class test
/**
* TestA class
*
* this is a description.
*
* $PP */
class TestA extends test
| scala/scala | test/scaladoc/resources/Trac4420.scala | Scala | apache-2.0 | 318 |
package at.logic.gapt.provers.viper
import at.logic.gapt.examples._
import at.logic.gapt.expr.hol.universalClosure
import at.logic.gapt.expr.{ Eq, FOLConst, FOLFunction }
import at.logic.gapt.formats.prover9.Prover9TermParserLadrStyle._
import at.logic.gapt.proofs.lk._
import at.logic.gapt.proofs.{ Ant, Suc, HOLSequen... | gebner/gapt | examples/RunOnProofSequence.scala | Scala | gpl-3.0 | 2,095 |
package com.markfeeney.circlet
import java.io.{InputStream, File}
import scala.language.implicitConversions
sealed trait ResponseBody
object ResponseBody {
final case class StringBody(value: String) extends ResponseBody
final case class SeqBody[T](value: Seq[T]) extends ResponseBody
final case class FileBody(va... | overthink/circlet | src/main/scala/com/markfeeney/circlet/ResponseBody.scala | Scala | mit | 591 |
package org.scaladebugger.api.pipelines
/**
* Represents an operation that filters data in a pipeline.
*
* @param filterNotFunc The function to filter data
* @tparam A The type of data coming into the operation
*/
class FilterNotOperation[A](
private val filterNotFunc: (A) => Boolean
) extends Operation[A, A] {... | ensime/scala-debugger | scala-debugger-api/src/main/scala/org/scaladebugger/api/pipelines/FilterNotOperation.scala | Scala | apache-2.0 | 579 |
/**
* Copyright 2013 Netflix, 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 ... | kevinwright/RxScala | src/main/scala/rxscala/Observer.scala | Scala | apache-2.0 | 2,122 |
// Copyright: 2010 - 2018 https://github.com/ensime/ensime-server/graphs
// License: http://www.gnu.org/licenses/lgpl-3.0.en.html
package org.ensime.sexp
import annotation.implicitNotFound
/** Provides the S-Exp deserialization for type T. */
@implicitNotFound(msg = "Cannot find SexpReader or SexpFormat for ${T}")
tr... | yyadavalli/ensime-server | s-express/src/main/scala/org/ensime/sexp/SexpFormat.scala | Scala | gpl-3.0 | 1,020 |
package com.plasmaconduit.waterhouse
import java.security.MessageDigest
object Hash {
def digest(algorithm: HashAlgorithm, text: String): HashDigest = {
digest(algorithm, text.getBytes)
}
def digest(algorithm: HashAlgorithm, bytes: Array[Byte]): HashDigest = {
HashDigest(
algorithm = algorithm,
... | plasmaconduit/waterhouse | src/main/scala/com/plasmaconduit/waterhouse/Hash.scala | Scala | mit | 952 |
package org.jetbrains.plugins.scala
package lang
package parser
package parsing
package top.template
import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes
import org.jetbrains.plugins.scala.lang.parser.parsing.base.Import
import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder
import org... | ilinum/intellij-scala | src/org/jetbrains/plugins/scala/lang/parser/parsing/top/template/TemplateStat.scala | Scala | apache-2.0 | 1,506 |
/*
* 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.testsuite.utils
import ja... | nicolasstucki/scala-js | test-suite/shared/src/test/scala/org/scalajs/testsuite/utils/CollectionsTestBase.scala | Scala | apache-2.0 | 4,919 |
package dotty.tools.dotc
package transform
import core._
import dotty.tools.dotc.transform.MegaPhase._
import Flags._
import Contexts.Context
import Symbols._
import dotty.tools.dotc.ast.tpd
import Decorators._
import reporting.messages._
/** A transformer that check that requirements of Static fields\\methods are im... | som-snytt/dotty | compiler/src/dotty/tools/dotc/transform/CheckStatic.scala | Scala | apache-2.0 | 3,427 |
/*
* 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 ... | dhruve/spark | core/src/main/scala/org/apache/spark/scheduler/cluster/StandaloneSchedulerBackend.scala | Scala | apache-2.0 | 8,501 |
/*
* 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/main/scala/uk/gov/hmrc/ct/ct600/v3/B600.scala | Scala | apache-2.0 | 1,168 |
/**
*
* FragmentHelper
* Ledger wallet
*
* Created by Pierre Pollastri on 22/01/15.
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Ledger
*
* 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 t... | Morveus/ledger-wallet-android | app/src/main/scala/com/ledger/ledgerwallet/base/RichFragment.scala | Scala | mit | 1,828 |
/*
* 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 ... | gioenn/xSpark | mllib/src/test/scala/org/apache/spark/ml/feature/MinMaxScalerSuite.scala | Scala | apache-2.0 | 3,463 |
package recfun
import common._
object Main {
def main(args: Array[String]) {
println("Pascal's Triangle")
for (row <- 0 to 10) {
for (col <- 0 to row)
print(pascal(col, row) + " ")
println()
}
}
/**
* Exercise 1
*/
def pascal(c: Int, r: Int): Int =
if (c == 0) 1
e... | shouya/thinking-dumps | progfun/week1/recfun/src/main/scala/recfun/Main.scala | Scala | mit | 1,176 |
package com.datawizards.sparklocal.dataset
import com.datawizards.sparklocal.SparkLocalBaseTest
import com.datawizards.sparklocal.implicits._
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class SampleTest extends SparkLocalBaseTest {
val data:Range = 1 to 10
... | piotr-kalanski/spark-local | src/test/scala/com/datawizards/sparklocal/dataset/SampleTest.scala | Scala | apache-2.0 | 1,890 |
/*
* 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 ... | guoxiaolongzte/spark | core/src/test/scala/org/apache/spark/deploy/security/KafkaTokenUtilSuite.scala | Scala | apache-2.0 | 9,458 |
package com.sasaki.utils
import org.apache.spark.mllib.regression.LabeledPoint
import org.apache.spark.mllib.linalg.{Vectors}
import com.sasaki.utils._
case class LabeledSet(
val vec: Array[Double],
val id: Long,
val label: Int,
val prediction: Int) {
// Transform LabeledSet to LabeledPoint.
def toNLP... | sasakigao/seq-clustering | pack-dimred/src/main/scala/com/sasaki/utils/LabeledSet.scala | Scala | apache-2.0 | 427 |
package tests.results
import org.scalatest._
import org.scalatest.matchers.ShouldMatchers
import relational.results._
class AttributesTest extends WordSpec with ShouldMatchers {
lazy val row = new Attributes(Map('id -> Attribute(1), 'name -> Attribute("Foo")))
"Attributes accessing" should {
"access with 'a... | mauricioszabo/relational-scala | src/test/scala/relational/results/AttributesTest.scala | Scala | artistic-2.0 | 723 |
package org.schedoscope.scheduler.actors
import akka.actor.{Actor, ActorRef, ActorSystem}
import akka.testkit.{EventFilter, ImplicitSender, TestActorRef, TestKit, TestProbe}
import com.typesafe.config.ConfigFactory
import org.scalatest.{BeforeAndAfterAll, FlatSpecLike, Matchers}
import org.schedoscope.Schedoscope
cla... | christianrichter/schedoscope | schedoscope-core/src/test/scala/org/schedoscope/scheduler/actors/PartitionCreatorActorTest.scala | Scala | apache-2.0 | 1,587 |
package controllers
import play.api.libs.ws._
import play.api.Logger._
import play.api.mvc.{Action, Controller}
import play.api.cache._
import models.{GeoName, GeoMatch, Article}
import scala.concurrent.Future
object CassandraCtl extends Controller {
import play.api.libs.concurrent.Execution.Implicits.defaultCont... | allixender/text2map | app/controllers/CassandraCtl.scala | Scala | apache-2.0 | 917 |
package streams
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import Bloxorz._
@RunWith(classOf[JUnitRunner])
class BloxorzSuite extends FunSuite {
trait SolutionChecker extends GameDef with Solver with StringParserTerrain {
/**
* This method applie... | macarran/coursera-progfun | Week 7/streams/src/test/scala/streams/BloxorzSuite.scala | Scala | mit | 2,346 |
package mimir.util;
import play.api.libs.json._
import mimir.algebra._
import mimir.serialization.Json
object JsonUtils {
val dotPrefix = "\\\\.([^.\\\\[]+).*".r
val bracketPrefix = "\\\\[([0-9]+)\\\\].*".r
implicit val primitiveValueWrites = new Writes[PrimitiveValue] {
def writes(p: PrimitiveValue): Js... | UBOdin/mimir | src/main/scala/mimir/util/JSONUtils.scala | Scala | apache-2.0 | 1,115 |
package africa.coin.crypto.hash
import java.security.MessageDigest
object SHA1Hash extends CryptographicHash {
private val hasher = MessageDigest.getInstance("SHA-1")
override def hash(byteSequence: Seq[Byte]): Vector[Byte] =
hasher.digest(byteSequence.toArray).toVector
}
| egoOyiri/egoLedger | src/main/scala/africa/coin/crypto/hash/SHA1Hash.scala | Scala | apache-2.0 | 284 |
package com.sksamuel.scapegoat.inspections.string
import com.sksamuel.scapegoat._
/** @author Stephen Samuel */
class IncorrectNumberOfArgsToFormat extends Inspection {
// format is: %[argument_index$][flags][width][.precision][t]conversion
final val argRegex = "%(\\\\d+\\\\$)?[-#+ 0,(\\\\<]*?\\\\d?(\\\\.\\\\d+)... | pwwpche/scalac-scapegoat-plugin | src/main/scala/com/sksamuel/scapegoat/inspections/string/IncorrectNumberOfArgsToFormat.scala | Scala | apache-2.0 | 1,066 |
package com.linkedin.norbert.network.garbagecollection
import com.linkedin.norbert.norbertutils.ClockComponent
/**
* Created by sishah on 7/6/15.
* Separate trait containing the function used to determine whether a node is GCing given its offset.
* Used by load balancers on the client side, and by network servers... | thesiddharth/norbert | network/src/main/scala/com/linkedin/norbert/network/garbagecollection/GcDetector.scala | Scala | apache-2.0 | 2,367 |
package workflow
/**
* A mix-in that attaches a weight to a node that represents how often it must iterate
* over its input.
*/
trait WeightedNode {
val weight: Int
}
| tomerk/keystone | src/main/scala/workflow/WeightedNode.scala | Scala | apache-2.0 | 173 |
package scuff.web
import javax.servlet._, http._
/**
* Supports the following wildcard resource syntax:
* * Wildcard (resources read in alphabetical order): "dir/foo*bar.js",
* matches any filename in dir that starts with "foo" and ends with "bar" and has the ".js" extension
* * Listed (resources read in listed... | nilskp/scuff | src/main/scala/scuff/web/ResourceConcatFilter.scala | Scala | mit | 6,257 |
object Exercise3_14 extends App {
@annotation.tailrec def foldLeft[A,B](as: List[A], z: B)(f: (B, A) => B): B =
as match {
case Nil => z
case x::xs => foldLeft(xs, f(z, x))(f)
}
def append[A](a1: List[A], a2: List[A]): List[A] = {
def helper[A](as: List[A], a: A): List[A] = {
a::as
... | hnfmr/fpscala | ex3.14.scala | Scala | mit | 430 |
package com.typesafe.slick.testkit.tests
import org.junit.Assert._
import scala.slick.util.iter._
import com.typesafe.slick.testkit.util.{TestkitTest, TestDB}
class IterateeTest(val tdb: TestDB) extends TestkitTest {
import tdb.profile.simple._
object A extends Table[(String, Int)]("a") {
def s = column[Stri... | boldradius/slick | slick-testkit/src/main/scala/com/typesafe/slick/testkit/tests/IterateeTest.scala | Scala | bsd-2-clause | 1,604 |
package net.lshift.diffa.agent.rest.exceptions
/**
* Copyright (C) 2010-2011 LShift 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/LIC... | aprescott/diffa | agent/src/main/scala/net/lshift/diffa/agent/rest/exceptions/InvalidSequenceNumberExceptionMapper.scala | Scala | apache-2.0 | 1,417 |
package models
import java.time.Instant
import anorm._
import java.sql.Connection
import scala.collection.{immutable => imm}
import scala.collection.immutable.{Seq, Vector}
case class ArticleId(value: Long) extends AnyVal
case class Article(
id: ArticleId,
bloggerId: BloggerId, title: String = "", body: String... | ruimo/blog | app/models/Article.scala | Scala | apache-2.0 | 9,039 |
/**
* 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 | deeplang/src/main/scala/io/deepsense/deeplang/doperables/dataframe/DataFrameColumnsGetter.scala | Scala | apache-2.0 | 7,565 |
package dao
import java.sql.Timestamp
import javax.inject.{Inject, Singleton}
import com.toscaruntime.constant.ExecutionConstant._
import models.TaskEntity
import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfigProvider}
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import slick.drive... | vuminhkh/tosca-runtime | deployer/app/dao/TaskDAO.scala | Scala | mit | 2,892 |
package com.olvind.crud
sealed trait CellRendering
object CellRendering {
private[crud] case object Link extends CellRendering
case object Text extends CellRendering
case object Number extends CellRendering
case object Checkbox extends CellRendering
... | skytteren/slick-crud | crud/shared/src/main/scala/com/olvind/crud/CellRendering.scala | Scala | apache-2.0 | 1,024 |
/*
* Copyright 2008-2010 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... | jeppenejsum/liftweb | examples/JPADemo/JPADemo-web/src/main/scala/net/liftweb/jpademo/snippet/Books.scala | Scala | apache-2.0 | 4,540 |
package scala.offheap
import scala.language.experimental.{macros => CanMacro}
import scala.offheap.internal.macros
/** An alternative implemenation of an array that inlines
* allocation of given offheap class into the array layout.
* This effectively makes it an array of structs in C sense.
*/
final class EmbedA... | densh/scala-offheap | core/src/main/scala/offheap/EmbedArray.scala | Scala | bsd-3-clause | 3,320 |
package uk.gov.dvla.vehicles.presentation.common.views
import org.scalatest.selenium.WebBrowser.{pageTitle, click}
import org.scalatest.selenium.WebBrowser.go
import uk.gov.dvla.vehicles.presentation.common.composition.TestHarness
import uk.gov.dvla.vehicles.presentation.common.helpers.UiSpec
import uk.gov.dvla.vehicl... | dvla/vehicles-presentation-common | common-test/test/uk/gov/dvla/vehicles/presentation/common/views/ValtechDeclareCheckIntegrationSpec.scala | Scala | mit | 2,315 |
/*
* 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/main/scala/org/scalatest/words/ExistWord.scala | Scala | apache-2.0 | 3,081 |
package playchat.protocols
import playchat.models._
import akka.actor.ActorRef
trait JoinChatProtocol
object JoinChatProcotol {
case class Joined(user: User, ref: ActorRef) extends JoinChatProtocol
case class Quit(user: User) extends JoinChatProtocol
}
| MrBogomips/PlayChat | app/playchat/protocols/JoinChat.scala | Scala | gpl-2.0 | 260 |
/*
* Copyright 2011-2021 Asakusa Framework Team.
*
* 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 ... | asakusafw/asakusafw-spark | extensions/iterativebatch/runtime/core/src/main/scala/com/asakusafw/spark/extensions/iterativebatch/runtime/graph/MapBroadcastAlways.scala | Scala | apache-2.0 | 1,331 |
package fr.ramiro.scala.growl
import org.scalatest.funsuite.AnyFunSuite
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.util.Success
class GrowlConnectorSuite extends AnyFunSuite {
val APPLICATION_ICON: String = "app-icon.png"
val RING_ICON: String = "ring.pn... | rrramiro/libgrowl | src/test/scala/fr/ramiro/scala/growl/GrowlConnectorSuite.scala | Scala | gpl-3.0 | 2,456 |
/*
* 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... | SRGOM/scalatest | scalatest/src/main/scala/org/scalatest/fixture/WordSpecRegistration.scala | Scala | apache-2.0 | 51,321 |
/*
* 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 ... | gioenn/xSpark | sql/catalyst/src/main/scala/org/apache/spark/sql/types/DoubleType.scala | Scala | apache-2.0 | 2,278 |
/*
* 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... | yiheng/BigDL | spark/dl/src/main/scala/com/intel/analytics/bigdl/utils/tf/loaders/ParseExample.scala | Scala | apache-2.0 | 1,953 |
/**
* 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"); yo... | gf53520/kafka | core/src/test/scala/unit/kafka/server/AbstractCreateTopicsRequestTest.scala | Scala | apache-2.0 | 9,276 |
package com.nagarjuna_pamu.awesomeness.adapter
import java.net.URL
import android.content.Context
import android.graphics.{Bitmap, BitmapFactory}
import android.os.AsyncTask
import android.text.Html
import android.util.Log
import android.view.{LayoutInflater, ViewGroup, View}
import android.webkit.WebView
import andr... | pamu/ScalaAndroid | src/main/scala/com/nagarjuna_pamu/awesomeness/adapter/CustomAdapter.scala | Scala | apache-2.0 | 4,995 |
package com.basho.riak.spark.examples.demos.fbl
import com.basho.riak.client.core.RiakNode
import com.basho.riak.client.core.query.Namespace
import com.basho.riak.spark.rdd._
import com.basho.riak.client.core.query.indexes.LongIntIndex
import com.basho.riak.spark.rdd.connector.RiakConnectorConf
import com.basho.riak.sp... | basho/spark-riak-connector | examples/src/main/scala/com/basho/riak/spark/examples/demos/fbl/Demo2iConfig.scala | Scala | apache-2.0 | 1,794 |
/**
* 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/main/scala/kafka/server/KafkaServer.scala | Scala | apache-2.0 | 26,787 |
package com.eevolution.context.dictionary.domain.api.repository
import com.eevolution.context.dictionary._
/**
* Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Publi... | adempiere/ADReactiveSystem | dictionary-api/src/main/scala/com/eevolution/context/dictionary/domain/api/repository/TreeNodeCMTRepository.scala | Scala | gpl-3.0 | 1,136 |
/**
* 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 us... | eribeiro/kafka | core/src/test/scala/integration/kafka/api/ConsumerBounceTest.scala | Scala | apache-2.0 | 6,086 |
package com.ldaniels528.broadway.core.util
import com.ldaniels528.commons.helpers.OptionHelper._
import scala.xml.Node
/**
* Scala XML Helper Utility
* @author Lawrence Daniels <lawrence.daniels@gmail.com>
*/
object XMLHelper {
/**
* Syntactic sugar and convenience methods for Node instances
* @param nod... | ldaniels528/shocktrade-broadway-server | src/main/scala/com/ldaniels528/broadway/core/util/XMLHelper.scala | Scala | apache-2.0 | 741 |
package frdomain.ch7
package streams
import akka.stream.stage.{SyncDirective, Context, StatefulStage}
import akka.util.ByteString
import scala.annotation.tailrec
object Stages {
def parseLines(separator: String, maximumLineBytes: Int) =
new StatefulStage[ByteString, String] {
private val separatorBytes ... | debasishg/frdomain | src/main/scala/frdomain/ch7/streams/parselines.scala | Scala | apache-2.0 | 2,349 |
/**
* Licensed to Gravity.com under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Gravity.com licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this fil... | matth/goose | src/main/scala/com/gravity/goose/network/HtmlFetcher.scala | Scala | apache-2.0 | 12,423 |
/*
* 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 ... | wwjiang007/flink | flink-quickstart/flink-quickstart-scala/src/main/resources/archetype-resources/src/main/scala/DataStreamJob.scala | Scala | apache-2.0 | 2,215 |
import scala.annotation.tailrec
object BinarySearch {
def find[T](seq: Seq[T], value: T)(implicit ord: T => Ordered[T]): Option[Int]
= searchInternal(seq, value, 0, seq.size - 1)
@tailrec
def searchInternal[T](seq: Seq[T], value: T,
start: Int, end: Int)(implicit ord: T => Ordered[T]... | exercism/xscala | exercises/practice/binary-search/.meta/Example.scala | Scala | mit | 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 may ... | ueshin/apache-spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TimestampFormatter.scala | Scala | apache-2.0 | 18,005 |
package polyite.fitness.classifier
import org.junit.Test
import org.junit.Assert._
import polyite.fitness.scikit_learn.Classifier
import polyite.fitness.Feature
import polyite.fitness.FeatureVect
import polyite.schedule.Schedule
import polyite.fitness.MemAccessPattern
import java.io.File
import polyite.fitness.DataLoc... | stganser/polyite | test/polyite/fitness/classifier/TestClassifier.scala | Scala | mit | 2,787 |
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.