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 gapt.proofs.expansion
import gapt.expr._
import gapt.proofs.Sequent
import gapt.proofs.context.mutable.MutableContext
import gapt.proofs.context.update.Sort
import gapt.proofs.gaptic._
import gapt.proofs.lk.transformations.LKToExpansionProof
import org.specs2.mutable.Specification
class UnifyInstancesTest ext... | gapt/gapt | tests/src/test/scala/gapt/proofs/expansion/UnifyInstancesTest.scala | Scala | gpl-3.0 | 962 |
package commons.repositories.mappings
import commons.models.Login
import commons.repositories.BaseRepo
import slick.dbio.DBIO
import slick.jdbc.MySQLProfile.api.{DBIO => _, MappedTo => _, TableQuery => _, Rep => _, _}
import slick.lifted._
trait LoginDbMappings {
implicit val loginMapping: BaseColumnType[Login] =... | Dasiu/play-framework-test-project | app/commons/repositories/mappings/LoginDbMappings.scala | Scala | mit | 413 |
package com.github.cdow.actor.vm
import java.net.InetSocketAddress
import akka.actor.{FSM, ActorRef, Props}
import akka.io.{IO, Tcp}
import akka.io.Tcp._
import akka.util.ByteString
import com.github.cdow.actor.MainMessage
import com.github.cdow.actor.vm.VmConnection.Disconnected
sealed trait VmMessage
object VmMess... | cdow/sbt-debug-plugin | src/main/scala/com/github/cdow/actor/vm/VmActor.scala | Scala | isc | 3,307 |
package slick.sql
import slick.basic.{BasicStreamingAction, BasicAction}
import slick.compiler.QueryCompiler
import slick.relational.{RelationalActionComponent, RelationalTableComponent, RelationalProfile}
import scala.language.higherKinds
import slick.dbio._
import slick.ast.{TableNode, Symbol, SymbolNamer, ColumnOp... | slick/slick | slick/src/main/scala/slick/sql/SqlProfile.scala | Scala | bsd-2-clause | 8,081 |
package com.atomist.project.generate
import com.atomist.param.ParameterValues
import com.atomist.project.ProjectOperation
import com.atomist.project.common.InvalidParametersException
import com.atomist.rug.kind.core.ProjectContext
import com.atomist.rug.runtime.js.LocalRugContext
import com.atomist.source.ArtifactSour... | atomist/rug | src/main/scala/com/atomist/project/generate/ProjectGenerator.scala | Scala | gpl-3.0 | 734 |
package io.getquill.norm
import io.getquill.Spec
import io.getquill.ast.AscNullsFirst
import io.getquill.ast.Constant
import io.getquill.ast.Ident
import io.getquill.ast.Map
import io.getquill.ast.SortBy
import io.getquill.testContext._
class AttachToEntitySpec extends Spec {
val attachToEntity = AttachToEntity(So... | mentegy/quill | quill-core/src/test/scala/io/getquill/norm/AttachToEntitySpec.scala | Scala | apache-2.0 | 6,081 |
package view
import service.RequestCache
import twirl.api.Html
import util.StringUtil
trait AvatarImageProvider { self: RequestCache =>
/**
* Returns <img> which displays the avatar icon.
* Looks up Gravatar if avatar icon has not been configured in user settings.
*/
protected def getAvatarImageHt... | chu888chu888/gitbucket | src/main/scala/view/AvatarImageProvider.scala | Scala | apache-2.0 | 1,810 |
package controllers
import play.api.mvc._
import play.api.libs.json.Json
import play.api.libs.concurrent.Execution.Implicits._
import models._
import reactivemongo.bson.BSONObjectID
import scala.concurrent.Future
import org.joda.time.DateTime
import org.joda.time.DateTimeZone.UTC
import play.api.Play.current
import ... | marinatedpork/pixi | app/controllers/PhantomController.scala | Scala | mit | 2,212 |
/*
* Copyright 2013 The SIRIS 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 applica... | simulator-x/core | src/simx/core/component/ComponentCreation.scala | Scala | apache-2.0 | 2,867 |
package debop4s.data.orm.jpa.mysql.repository
import javax.persistence.QueryHint
import debop4s.data.orm.jpa.ScalaJpaEntity2
import org.springframework.data.jpa.repository.{JpaRepository, Query, QueryHints}
import org.springframework.data.repository.query.Param
import org.springframework.stereotype.Repository
import ... | debop/debop4s | debop4s-data-orm/src/test/scala/debop4s/data/orm/jpa/mysql/repository/ScalaJpaEntity2Repository.scala | Scala | apache-2.0 | 757 |
/*
* 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 | external/kafka-0-10-token-provider/src/test/scala/org/apache/spark/kafka010/KafkaTokenSparkConfSuite.scala | Scala | apache-2.0 | 7,681 |
package controllers.techsupport
import play.api.mvc._
import play.api.data._
import play.api.data.Forms._
/**
* Created by hooxin on 15-2-23.
*/
object Tracking extends Controller{
def add(id:Long) = TODO
def remove(id:Long) =TODO
def update(id:Long) = TODO
def get(id:Long) = TODO
def list = TODO
}
| firefoxmmx2/techsupport_ext4_scala | app/controllers/techsupport/Tracking.scala | Scala | apache-2.0 | 313 |
package fpinscala
import org.scalatest.Matchers
import org.scalatest.prop.GeneratorDrivenPropertyChecks
import org.scalatest.FlatSpec
trait SpecBase extends FlatSpec with Matchers with GeneratorDrivenPropertyChecks {
} | castle8080/fpinscala | exercises/src/test/scala/fpinscala/SpecBase.scala | Scala | mit | 223 |
package au.csiro.ict
import org.joda.time.format.DateTimeFormat
import org.joda.time.{DateTimeZone, DateTime}
object Utils {
val TIMESTAMP_YYYYD_FORMAT = DateTimeFormat.forPattern("yyyyD").withZoneUTC()
val yyyyFormat = DateTimeFormat.forPattern("yyyy").withZoneUTC()
val yyyyWWFormat = DateTimeFormat.forPattern... | sensorgroup/sensordb | src/main/scala/au/csiro/ict/Helpers.scala | Scala | mpl-2.0 | 1,735 |
package xyz.hyperreal.typesetter
import scala.swing._
import java.awt.RenderingHints._
import java.awt.Color._
import java.awt.Font._
import java.awt.geom._
import java.io._
object TypesetterTest extends MainFrame with App
{
val t = new Typesetter
val fs = System.getProperties.getProperty( "file.separator" )
va... | edadma/typesetter | src/main/scala/TypesetterTest.scala | Scala | mit | 3,819 |
// Copyright 2012 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,... | travisbrown/zipkin | zipkin-cassandra/src/main/scala/com/twitter/cassie/ReadConsistency.scala | Scala | apache-2.0 | 2,363 |
package benchmarks.philosophers
import benchmarks.philosophers.PhilosopherTable._
import rescala.core.{Engine, Struct}
import rescala.reactives.{Signals, Var}
class DynamicPhilosopherTable[S <: Struct](philosopherCount: Int, work: Long)(override implicit val engine: Engine[S]) extends PhilosopherTable(philosopherCoun... | volkc/REScala | Research/Microbenchmarks/src/main/scala/benchmarks/philosophers/DynamicPhilosopherTable.scala | Scala | apache-2.0 | 3,523 |
package com.twitter.finagle.http
import com.twitter.conversions.StorageUnitOps._
import com.twitter.conversions.DurationOps._
import com.twitter.finagle
import com.twitter.finagle.{Service, ServiceFactory}
import com.twitter.finagle.context.Contexts
import com.twitter.finagle.http2.RstException
import com.twitter.fina... | twitter/finagle | finagle-http/src/test/scala/com/twitter/finagle/http/AbstractH2CEndToEndTest.scala | Scala | apache-2.0 | 13,967 |
/*
* Copyright 2015 Goldman Sachs.
*
* 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 ... | Pelumi/gs-collections | scala-unit-tests/src/test/scala/com/gs/collections/impl/Prelude.scala | Scala | apache-2.0 | 4,107 |
package de.ljfa.advbackport.asm
import de.ljfa.advbackport.Config
import de.ljfa.advbackport.logic.ItemLogic
import net.minecraft.block.Block
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
import de.ljfa.advbackport.logic.PlayerLogic
class AdventureHooks
object AdventureHooks {
... | ljfa-ag/Adventure-Backport | src/main/scala/de/ljfa/advbackport/asm/AdventureHooks.scala | Scala | mit | 570 |
package com.nthportal.euler
package h0.t1
import com.nthportal.euler.maths.NumericFormat
import scala.util.{Success, Try}
object Problem11 extends ProjectEulerProblem {
private val numAdjacent = 4
private val numStr =
"08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08\\n" +
"49 49 99 40 17 8... | NthPortal/euler-n-scala | src/main/scala/com/nthportal/euler/h0/t1/Problem11.scala | Scala | mit | 2,666 |
/*
* Copyright © 2014 TU Berlin (emma@dima.tu-berlin.de)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by app... | emmalanguage/emma | emma-lib/src/test/scala/org/emmalanguage/lib/graphs/TransitiveClosureSpec.scala | Scala | apache-2.0 | 2,203 |
package org.http4s
package server
package middleware
import cats.ApplicativeError
import cats.data.Kleisli
import fs2._
import scala.util.control.NoStackTrace
object EntityLimiter {
final case class EntityTooLarge(limit: Long) extends Exception with NoStackTrace
val DefaultMaxEntitySize: Long = 2L * 1024L * 10... | aeons/http4s | server/src/main/scala/org/http4s/server/middleware/EntityLimiter.scala | Scala | apache-2.0 | 889 |
package almond.channels
import java.nio.charset.StandardCharsets
import java.{util => ju}
import scala.util.Try
final case class Message(
idents: Seq[Seq[Byte]],
header: Array[Byte],
parentHeader: Array[Byte],
metadata: Array[Byte],
content: Array[Byte]
) {
override def toString: String = {
val b = n... | alexarchambault/jupyter-scala | modules/shared/channels/src/main/scala/almond/channels/Message.scala | Scala | apache-2.0 | 1,395 |
/*
* 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 | test/iht/views/registration/RegistrationChecklistViewTest.scala | Scala | apache-2.0 | 5,811 |
package controllers
import play.api.i18n.Lang
import play.api.mvc.RequestHeader
import play.api.templates.{Html, Txt}
import securesocial.controllers.MailTemplates
import securesocial.core.BasicProfile
/**
* @author Joseph Dessens
* @since 2014-09-03
*/
object AngularMailTemplates extends MailTemplates {
overrid... | vega113/emotracker | app/controllers/AngularMailTemplates.scala | Scala | apache-2.0 | 1,423 |
package name.abhijitsarkar.akka
import java.nio.file.{Files, Paths}
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Sink, Source}
import akka.testkit.{ImplicitSender, TestKit}
import org.scalatest._
import scala.concurrent.Await
import scala.concurrent.duration._
impor... | asarkar/akka | akka-streams-learning/weather-streaming/src/test/scala/name/abhijitsarkar/akka/TransformerSpec.scala | Scala | gpl-3.0 | 1,501 |
/*
* 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 ... | bdrillard/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala | Scala | apache-2.0 | 65,206 |
/*
* 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 | disk/stub/com/treode/disk/stubs/Counter.scala | Scala | apache-2.0 | 5,053 |
/*
* Copyright (C) 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, or
* (at your option) any later version.
*
* This... | beangle/commons | core/src/main/scala/org/beangle/commons/collection/IdentityMap.scala | Scala | lgpl-3.0 | 3,430 |
package feh.tec.cvis.common.cv
import feh.tec.cvis.common.cv.Helper._
import org.opencv.core.{Core, Mat, Point}
trait Clustering {
sealed abstract class CentersPolicy(val value: Int)
object CentersPolicy{
/** Select random initial centers in each attempt */
object Random extends CentersPolicy(Core.KMEANS... | fehu/comp-vis | common/src/main/scala/feh/tec/cvis/common/cv/Clustering.scala | Scala | mit | 4,529 |
import math.ceil
object Problem1 {
def arithmetic_sum(x: Int) : Int = x*(x+1)/2
def special_sum(n: Int): Int = {
var a: Int = ceil(n/3.toFloat).toInt - 1
var b: Int = ceil(n/5.toFloat).toInt - 1
var c: Int = ceil(n/15.toFloat).toInt - 1
3*arithmetic_sum(a) + 5*arithmetic_sum(b) - 15*arithmetic_sum... | LuqmanSahaf/Solve-Project-Euler | Problem1/scala/Problem1.scala | Scala | mit | 457 |
/**
* Licensed to the Minutemen Group under one or more contributor license
* agreements. See the COPYRIGHT file distributed with this work for
* additional information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in complian... | mohiva/silhouette | modules/jwt-jose4j/src/test/scala/silhouette/jwt/jose4j/FormatSpec.scala | Scala | apache-2.0 | 7,672 |
#!/bin/bash
exec scala \\
-Djava.library.path="../lib/linux_x86" \\
-classpath "../bin:../lib:../lib/linux_x86/com.google.ortools.jar" \\
"$0" "$@"
!#
/** USAGE: ./coeff.scala DIMA DIMB - [u1 u2 ..] / [v1 v2 ...] / [w1 w2 ...]
*
* DIMA and DIMB are the size of the cubicles
* ui, vi and wi are permutations of... | expz/polytope | scripts/productFlagCoeffs.scala | Scala | gpl-3.0 | 2,339 |
/*
* 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 | core/src/main/scala/org/apache/spark/storage/BlockManagerMasterEndpoint.scala | Scala | apache-2.0 | 27,809 |
/*
* 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/batch-updater | src/main/scala/uk/gov/hmrc/batchupdater/UpdateAction.scala | Scala | apache-2.0 | 824 |
package scala.meta
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.{PsiFile, PsiManager}
import org.jetbrains.plugins.scala.lang.psi.api.base.ScAnnotation
trait EnvironmentProvider {
def findFileByPath(path: String): PsiFile = {
val virtualF... | JetBrains/intellij-scala | scala/scala-impl/src/scala/meta/EnvironmentProvider.scala | Scala | apache-2.0 | 893 |
/* __ *\\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL **
** __\\ \\/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\\___/_/... | xuwei-k/scala-js | scalalib/overrides-2.13/scala/collection/mutable/Buffer.scala | Scala | bsd-3-clause | 1,807 |
package finatra.quickstart.domain.http
import com.twitter.finatra.validation._
import finatra.quickstart.domain.Location
case class TweetLocation(
@Range(min = -85, max = 85) lat: Double,
@Range(min = -180, max = 180) long: Double) {
def toDomain = {
Location(lat, long)
}
}
| syamantm/finatra | examples/twitter-clone/src/main/scala/finatra/quickstart/domain/http/TweetLocation.scala | Scala | apache-2.0 | 290 |
package org.jetbrains.plugins.scala
package lang
package psi
package impl
package toplevel
package imports
import com.intellij.lang.ASTNode
import com.intellij.psi.PsiElement
import org.jetbrains.plugins.scala.extensions.{ObjectExt, StubBasedExt}
import org.jetbrains.plugins.scala.lang.TokenSets.IMPORT_WILDCARDS
impor... | JetBrains/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/lang/psi/impl/toplevel/imports/ScImportExprImpl.scala | Scala | apache-2.0 | 4,145 |
package com.twitter.scrooge.java_generator
import com.twitter.scrooge.ast._
import com.twitter.scrooge.ast.SetType
import com.twitter.scrooge.ast.MapType
class FieldValueMetadataController(
fieldType: FieldType,
generator: ApacheJavaGenerator,
ns: Option[Identifier])
extends BaseController(generator, ns... | elipoz/scrooge | scrooge-generator/src/main/scala/com/twitter/scrooge/java_generator/FieldValueMetadataController.scala | Scala | apache-2.0 | 1,069 |
/*
* 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 ... | mike0sv/spark | external/kinesis-asl/src/test/scala/org/apache/spark/streaming/kinesis/KinesisReceiverSuite.scala | Scala | apache-2.0 | 8,657 |
/*
*
* Copyright (c) 2016 LIBBLE team supervised by Dr. Wu-Jun LI at Nanjing University.
* 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.apac... | syh6585/LIBBLE-Spark | src/main/scala/collaborativeFiltering/MatrixFactorization.scala | Scala | apache-2.0 | 8,662 |
package com.rumblesan.giftest
import processing.core._
object App {
def main(args: Array[String]) {
PApplet.main(
Array("com.rumblesan.giftest.Giftest")
)
}
}
| rumblesan/giftest | src/main/scala/App.scala | Scala | mit | 182 |
/**
* Copyright 2015 Thomson Reuters
*
* 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 ag... | nruppin/CM-Well | server/cmwell-controller/src/main/scala/cmwell/ctrl/controllers/ComponentController.scala | Scala | apache-2.0 | 3,259 |
package fpscala.chapter7
import java.util.concurrent._
import scala.util._
object Par {
type Par[A] = ExecutorService => Future[A]
val globEs = Executors.newFixedThreadPool(1)
def run[A](s: ExecutorService)(a: Par[A]): Future[A] = a(s)
def mapWithTimeouts[A, B, C](a: Par[A], b: Par[B])(f: (A, B) => C): Pa... | sajit/learnyou | scala/minimal-scala/src/main/scala/fpscala/chapter7/Par.scala | Scala | mit | 4,711 |
package org.scalatra
import javax.servlet.http.{ Cookie => ServletCookie }
import org.scalatra.test.scalatest.ScalatraFunSuite
class RequestCookiesTest extends ScalatraFunSuite {
addServlet(new ScalatraServlet {
get("/multi-cookies") {
Seq("one", "two", "three") map { key =>
response.setHeader(ke... | 0xfaded/scalatra | core/src/test/scala/org/scalatra/RequestCookiesTest.scala | Scala | bsd-2-clause | 1,072 |
package com.twitter.finagle.httpx.service
import com.twitter.finagle.Service
import com.twitter.finagle.httpx.{Request, Response, Method}
import com.twitter.finagle.httpx.path.Path
import com.twitter.util.Future
/**
* RoutingService for composing Services. Responds with 404 Not Found if no
* matching service.
*
... | LithiumTD/finagle | finagle-httpx/src/main/scala/com/twitter/finagle/httpx/service/RoutingService.scala | Scala | apache-2.0 | 2,441 |
object SumOddElements extends App{
def f(arr:List[Int]):Int = arr.filter(_ % 2 != 0).sum
} | PaulNoth/hackerrank | practice/functional_programming/introduction/sum_of_odd_elements/SumOddElements.scala | Scala | mit | 93 |
package zzb.datatype
import java.io._
import org.scalatest.{MustMatchers, WordSpec}
/**
* Created by Simon on 2014/4/29
*/
class MapTypeTest extends WordSpec with MustMatchers {
import zzb.datatype.BasicFormats._
val Colors = TMap[String, Int]("colors", "colors")
object House extends TStruct {
val co... | stepover/zzb | zzb-datatype/src/test/scala/zzb/datatype/MapTypeTest.scala | Scala | mit | 1,538 |
package reactivemongo.api
import scala.util.{ Failure, Success, Try }
import scala.concurrent.{ ExecutionContext, Future }
import reactivemongo.util.ExtendedFutures.DelayedFuture
import reactivemongo.core.netty.BufferSequence
import reactivemongo.core.protocol.{
GetMore,
KillCursors,
MongoWireVersion,
Quer... | ornicar/ReactiveMongo | driver/src/main/scala/api/DefaultCursor.scala | Scala | apache-2.0 | 15,491 |
package org.jetbrains.plugins.scala
package lang.rearranger
import java.util
import com.intellij.openapi.util.TextRange
import com.intellij.psi.codeStyle.arrangement._
import com.intellij.psi.codeStyle.arrangement.std.ArrangementSettingsToken
/**
* @author Roman.Shein
* Date: 08.07.13
*/
class ScalaArrangementEnt... | loskutov/intellij-scala | src/org/jetbrains/plugins/scala/lang/rearranger/ScalaArrangementEntry.scala | Scala | apache-2.0 | 2,089 |
/*
* Copyright 2015 Heiko Seeberger
*
* 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... | viktorklang/akka-sse | akka-sse-example/src/main/scala/de/heikoseeberger/akkasse/example/TimeServer.scala | Scala | apache-2.0 | 1,981 |
// scala gives you tons of ways of writing *anonymous Functions*
val predicate: Int => Boolean = (x: Int) => x > 2
val predicate: Int => Boolean = x => x > 2
val predicate: Int => Boolean = _ > 2
val predicate: Int => Boolean = (_: Int) > 2 // YUCK!
val predicate: Int => Boolean = {
case x if x > 2 => true
... | agconti/scala-school | 04-functions-as-values/slides/slide056.scala | Scala | mit | 399 |
/*
* 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/connector/AlterTablePartitionV2SQLSuite.scala | Scala | apache-2.0 | 7,060 |
/*
* 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 ... | UndeadBaneGitHub/spark | mllib/src/main/scala/org/apache/spark/ml/feature/FeatureHasher.scala | Scala | apache-2.0 | 7,940 |
package com.etsy.conjecture.text
import com.etsy.conjecture.data.{ AbstractInstance, BinaryLabeledInstance, LabeledInstance, StringKeyedVector }
import com.twitter.algebird.Operators._
import cascading.tuple.Fields
import cascading.pipe.Pipe
import scala.collection.JavaConverters._
object FeatureHelper {
impo... | zviri/Conjecture | src/main/scala/com/etsy/conjecture/text/FeatureHelper.scala | Scala | mit | 3,659 |
package org.bitcoins.spvnode.messages.data
import org.bitcoins.core.protocol.CompactSizeUInt
import org.bitcoins.core.util.Factory
import org.bitcoins.spvnode.messages.NotFoundMessage
import org.bitcoins.spvnode.serializers.messages.data.RawNotFoundMessageSerializer
/**
* Created by chris on 6/2/16.
* The compani... | Christewart/bitcoin-s-spv-node | src/main/scala/org/bitcoins/spvnode/messages/data/NotFoundMessage.scala | Scala | mit | 892 |
package models.daos
import java.util.UUID
import scala.concurrent.Future
import models.{ Major, Subject, Department }
trait MajorSubjectDAO {
def findByMajor(id: UUID): Future[Seq[(Subject, Boolean)]]
def findBySubject(code: String, department: Department): Future[Seq[(Major, Boolean)]]
}
| yoo-haemin/hufs-planner | project/app/models/daos/MajorSubjectDAO.scala | Scala | agpl-3.0 | 310 |
package endpoints.xhr.future
import endpoints.xhr
import scala.concurrent.{Future, Promise}
/**
* Implements [[xhr.Endpoints]] by using Scala’s [[Future]]s.
*/
trait Endpoints extends xhr.Endpoints {
/** Maps `Result` to [[Future]] */
type Result[A] = Future[A]
def endpoint[A, B](request: Request[A], res... | Krever/endpoints | xhr/client/src/main/scala/endpoints/xhr/future/Endpoints.scala | Scala | mit | 644 |
class MultiApply extends (Int => Int) with ((Int, Int) => Int) {
def apply(x: Int): Int = x + x
def apply(x: Int, y: Int): Int = x * y
}
@main
def Test = {
val fun = new MultiApply
assert(fun(2) == 4)
assert(fun(2, 3) == 6)
} | dotty-staging/dotty | tests/run/multi-apply.scala | Scala | apache-2.0 | 236 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | sjtu-iiot/graphx-algorithm | src/main/scala/org/apache/spark/graphx/lib/PageRank.scala | Scala | gpl-2.0 | 6,967 |
/*
* 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 ... | TiVo/samza | samza-core/src/main/scala/org/apache/samza/config/SerializerConfig.scala | Scala | apache-2.0 | 1,793 |
package predict4s
package sgp
import org.scalatest.FunSuite
import org.scalactic.TolerantNumerics
import org.scalactic.Equality
import predict4s.coord._
class GeoPotentialStateCheck extends FunSuite with TLE00005 with TLE06251 {
implicit val doubleEquality = TolerantNumerics.tolerantDoubleEquality(1E-9)
impli... | pleira/SGP4Extensions | tests/src/test/scala/predict4s/sgp/GeoPotentialStateCheck.scala | Scala | apache-2.0 | 3,325 |
import sbt._
import sbt.Keys._
import sbt.Def.Initialize
import scala.util.Try
import BackgroundServiceKeys._
import spray.revolver.RevolverPlugin.Revolver
import spray.revolver.AppProcess
import scala.util.{ Success, Failure }
import scala.concurrent.duration._
import java.util.concurrent.TimeoutException
import Utils... | mighdoll/sparkle | project/BackgroundService.scala | Scala | apache-2.0 | 8,177 |
package org.nkvoll.javabin.json
import org.joda.time.format.ISODateTimeFormat
import org.joda.time.{ DateTimeZone, DateTime }
import spray.json._
trait DateTimeProtocol {
implicit val dateTimeFormat = new JsonFormat[DateTime] {
override def read(json: JsValue): DateTime = json match {
case JsString(value)... | nkvoll/javabin-rest-on-akka | src/main/scala/org/nkvoll/javabin/json/DateTimeProtocol.scala | Scala | mit | 615 |
/*
* 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/computations/CP114.scala | Scala | apache-2.0 | 923 |
package com.sksamuel.elastic4s.http.search.aggs
import com.sksamuel.elastic4s.DistanceUnit._
import com.sksamuel.elastic4s.http.ScriptBuilderFn
import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory}
import com.sksamuel.elastic4s.searches.aggs.GeoDistanceAggregation
import com.sksamuel.elastic4s.searches... | Tecsisa/elastic4s | elastic4s-http/src/main/scala/com/sksamuel/elastic4s/http/search/aggs/GeoDistanceAggregationBuilder.scala | Scala | apache-2.0 | 2,361 |
import scala.quoted._
def test(using QuoteContext) = {
val q = '[String]
'[String]
}
| som-snytt/dotty | tests/pos/i4539.scala | Scala | apache-2.0 | 89 |
/*
* Copyright 2016 Michal Harish, michal.harish@gmail.com
*
* 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 ... | amient/affinity | examples/example-distributed-graph/src/test/scala/AnalyticsSystemSpec.scala | Scala | apache-2.0 | 4,756 |
package com.clemble.query.model
trait ExpressionField {
val field: String
def asc = Ascending(field)
def desc = Descending(field)
}
case class StringField(field: String) extends ExpressionField {
def is(str: String): Expression = Equals(field, str)
def not(str: String): Expression = NotEquals(field, str)
... | clemble/scala-query-dsl | src/main/scala/com/clemble/query/model/ExpressionField.scala | Scala | apache-2.0 | 789 |
object Test extends App {
import scala.reflect.runtime.universe._
//
// x's owner is outer Test scope. Previosly the quasiquote expansion
// looked like:
//
// object Test {
// build.withFreshTermName("doWhile")(n =>
// LabelDef(n, List(),
// Block(
// List({ ... | som-snytt/dotty | tests/disabled/reflect/run/t8047.scala | Scala | apache-2.0 | 998 |
/*
* 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 | core/src/test/scala/quasar/fs/mount/MountsSpec.scala | Scala | apache-2.0 | 1,682 |
package core.model
class Post {
var title: String = ""
var body: String = ""
var info: String = ""
var crawledAt: Long = 0L
} | hpedrorodrigues/GizmodoBr | app/core/model/Post.scala | Scala | apache-2.0 | 138 |
/*
* Copyright (C) 2009-2011 Mathias Doenitz
*
* 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... | sirthias/parboiled | parboiled-scala/src/main/scala/org/parboiled/scala/rules/PushRule.scala | Scala | apache-2.0 | 39,836 |
package paint
import core.host.{Host, HostPool}
import core.spatial.{Viewable, Zone}
import play.api.libs.json.Json
import scala.collection.mutable.ListBuffer
import scala.util.Random
class PaintHost(zone: Zone) extends Host( zone) {
val id2cameraNotifier = collection.mutable.HashMap[String, String]()
var elem... | DeltaIMT/Delta | paint_server/src/main/scala/paint/PaintHost.scala | Scala | mit | 2,177 |
package ru.primetalk.synapse.core.components
import ru.primetalk.synapse.core.dsl.ContactsDsl
/**
* @author zhizhelev, 05.04.15.
*/
trait RttiContactExt extends ContactsDsl {
/** Contact with runtime type information.
* Can be used for static analysis of the system. At least checking Nop links to connect comp... | ppopoff/SynapseGrid | synapse-grid-core/src/main/scala/ru/primetalk/synapse/core/components/RttiContactExt.scala | Scala | bsd-2-clause | 512 |
package com.ajjpj.adiagram_.ui.fw
import javafx.beans.property.SimpleStringProperty
import org.scalatest.{FunSuite, Matchers}
/**
* @author arno
*/
class DigestTest extends FunSuite with Matchers {
// test("bind target function") {
// val digest = new Digest()
//
// var source = "a"
// var target = "b"
/... | arnohaase/a-diagram | src/test/scala/com/ajjpj/adiagram_/ui/fw/DigestTest.scala | Scala | apache-2.0 | 2,536 |
package org.scalajs.openui5.sap.ui.layout
import org.scalajs.openui5.sap.ui.core._
import org.scalajs.openui5.util.{Settings, SettingsMap, noSettings}
import scala.scalajs.js
import scala.scalajs.js.annotation.{ScalaJSDefined, JSName}
@ScalaJSDefined
trait BlockLayoutCellSettings extends ControlSettings
object Block... | lastsys/scalajs-openui5 | src/main/scala/org/scalajs/openui5/sap/ui/layout/BlockLayoutCell.scala | Scala | mit | 1,567 |
val R = """\\|....\\|.(\\d\\d\\d\\d-\\d\\d-\\d\\d)[^\\d]+(\\d+)[^\\d]+([\\d.]+)[^\\d]+([\\d.]+)[^\\d]+([\\d.]+).*$""".r
case class Reading(readingDate:String, mileage:Int, miles:Double, litres:Double, cost:Double );
val readings = scala.io.Source.fromFile("/home/pperhac/temp/refuel.txt").getLines.map(l => l match {case... | PeterPerhac/cheat-sheets | scala-scratches/parse-text2caseclass-regex.scala | Scala | unlicense | 491 |
package org.jetbrains.plugins.scala
package lang
package parser
package parsing
package top.params
import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes
import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder
/**
* @author Alexander Podkhalyuzin
* Date: 08.02.2008
*/
/*
* ClassParamCl... | JetBrains/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/lang/parser/parsing/top/params/ImplicitClassParamClause.scala | Scala | apache-2.0 | 1,951 |
/**
* MinCutMutable.scala
* Mike Abraham
*
* Given a tab-delimited file containing an adjacency list representation
* of a simple undirected graph with 200 vertices labeled 1 to 200,
* run a randomized contraction algorithm and compute the minimum cut.
*
* Since this algorithm doesn't guarantee a min cu... | mikeabraham/InterviewQuestionsInScala | src/main/scala/MinCutMutable.scala | Scala | unlicense | 5,013 |
/*
* Copyright 2014-2021 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 agr... | brharrington/atlas | atlas-eval/src/main/scala/com/netflix/atlas/eval/model/TimeGroup.scala | Scala | apache-2.0 | 1,392 |
package io.eels.component.parquet
import io.eels._
import org.apache.parquet.filter2.predicate.{FilterApi, FilterPredicate}
import org.apache.parquet.io.api.Binary
object ParquetPredicateBuilder extends PredicateBuilder[FilterPredicate] {
override def build(predicate: Predicate): FilterPredicate = {
predicate ... | stheppi/eel | eel-components/src/main/scala/io/eels/component/parquet/ParquetPredicateBuilder.scala | Scala | apache-2.0 | 4,232 |
/*
* 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/test/scala/com/intel/analytics/bigdl/utils/tf/loaders/DigammaSpec.scala | Scala | apache-2.0 | 1,060 |
/*
* 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 ... | spark-test/spark | sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/ScriptTransformationSuite.scala | Scala | apache-2.0 | 10,348 |
package functional
import java.text.SimpleDateFormat
import play.api.test._
import play.api.test.Helpers._
import play.api.i18n.MessagesApi
import play.api.i18n.{Lang, Messages, MessagesImpl, MessagesProvider}
import java.time.Instant
import play.api.{Application => PlayApp}
import play.api.inject.guice.GuiceApplicati... | ruimo/store2 | test/functional/OrderHistorySpec.scala | Scala | apache-2.0 | 25,081 |
/*
* 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 | test/iht/models/application/debts/AllLiabilitiesTest.scala | Scala | apache-2.0 | 9,876 |
/*
* Copyright 2021 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | hmrc/play-events | src/test/scala/uk/gov/hmrc/play/events/examples/ExampleMetricEvent.scala | Scala | apache-2.0 | 1,113 |
package com.datastax.spark.connector.rdd
import com.datastax.oss.driver.api.core.CqlSession
import com.datastax.oss.driver.api.core.cql.AsyncResultSet
import com.datastax.oss.driver.internal.core.cql.ResultSets
import com.datastax.spark.connector._
import com.datastax.spark.connector.util.maybeExecutingAs
import com.d... | datastax/spark-cassandra-connector | connector/src/main/scala/com/datastax/spark/connector/rdd/CassandraLeftJoinRDD.scala | Scala | apache-2.0 | 6,691 |
package cbt
import java.io._
object paths{
val cbtHome: File = new File(Option(System.getenv("CBT_HOME")).get)
val mavenCache: File = cbtHome ++ "/cache/maven"
val userHome: File = new File(Option(System.getProperty("user.home")).get)
val stage1: File = new File(Option(System.getenv("STAGE1")).get)
val stag... | tobias-johansson/cbt | stage1/paths.scala | Scala | bsd-2-clause | 717 |
package slick.jdbc.hikaricp
import java.sql.{Connection, Driver}
import com.typesafe.config.Config
import slick.jdbc.{JdbcDataSource, JdbcDataSourceFactory}
import slick.util.ConfigExtensionMethods._
/** A JdbcDataSource for a HikariCP connection pool.
* See `slick.jdbc.JdbcBackend#Database.forConfig` for document... | kwark/slick | slick-hikaricp/src/main/scala/slick/jdbc/hikaricp/HikariCPJdbcDataSource.scala | Scala | bsd-2-clause | 4,373 |
package org.vertx.scala.core
import org.vertx.java.core.{ SSLSupport => JSSLSupport }
import org.vertx.scala.{Self, AsJava}
trait SSLSupport extends Self
with AsJava {
override type J <: JSSLSupport[_]
/**
* If `ssl` is `true`, this signifies that any connections will be SSL connections.
* @return A ref... | vert-x/mod-lang-scala | src/main/scala/org/vertx/scala/core/SSLSupport.scala | Scala | apache-2.0 | 2,794 |
package nb.bar.management.model
import scala.scalajs.js
import scala.scalajs.js.annotation.ScalaJSDefined
/**
* Created by Nadie on 29/05/16.
*/
@ScalaJSDefined
trait Product extends js.Object{
val name: String;
val price: Float;
val productId: Int;
// def getName(): String;
// def get... | gdabi/SamoApp | src/main/scala/nb/bar/management/model/Product.scala | Scala | gpl-3.0 | 364 |
/*
* Copyright (c) 2013-2014 Telefónica Investigación y Desarrollo S.A.U.
*
* 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
*
* Unles... | telefonicaid/fiware-cosmos-platform | infinity/server/src/test/scala/es/tid/cosmos/infinity/server/MockCosmosApi.scala | Scala | apache-2.0 | 4,982 |
package io.estatico.effect.laws.imports
import org.scalacheck.Prop
trait LawInstances extends LawTypes {
implicit def toIsEqArrow[A](a: A): IsEqArrow[A] = new IsEqArrow(a)
implicit def lawsIsEqToProp[A : Eq](isEq: IsEq[A]): Prop = cats.laws.discipline.catsLawsIsEqToProp(isEq)
}
/** Re-export of cats' IsEqArrow... | estatico/scala-effect | laws/src/main/scala/io/estatico/effect/laws/imports/LawInstances.scala | Scala | apache-2.0 | 454 |
package mimir.sql;
import java.sql.SQLException
import java.util
import mimir.Database
import mimir.algebra._
import mimir.provenance._
import mimir.optimizer.operator.{InlineProjections, PushdownSelections}
import mimir.util.SqlUtils
import com.typesafe.scalalogging.LazyLogging
import sparsity.statement.Statement
... | UBOdin/mimir | src/main/scala/mimir/sql/RAToSql.scala | Scala | apache-2.0 | 20,607 |
package dsmoq.controllers
import org.scalatra.ActionResult
import org.scalatra.NotFound
import org.scalatra.Ok
import org.scalatra.ScalatraServlet
/**
* /にマッピングされるサーブレットクラス
* Viewのファイルへのルーティングを提供する。
*/
class ResourceController extends ScalatraServlet {
/**
* 取り扱う拡張子
*/
object Ext {
val Js = """.*\\.j... | nkawa/dsmoq | server/apiServer/src/main/scala/dsmoq/controllers/ResourceController.scala | Scala | apache-2.0 | 3,106 |
/* Copyright (c) 2015 Andrée Ekroth.
* Distributed under the MIT License (MIT).
* See accompanying file LICENSE or copy at
* http://opensource.org/licenses/MIT
*/
package com.github.ekroth
package spotify
/** Commands corresponding to the Spotify Web API v1. */
trait Commands {
self: Caching with Extensions =>
... | ekroth/play-spotify | src/main/scala/com/github/ekroth/spotify/Commands.scala | Scala | mit | 11,282 |
/**
*
* Copyright (C) 2017 University of Bamberg, Software Technologies Research Group
* <https://www.uni-bamberg.de/>, <http://www.swt-bamberg.de/>
*
* This file is part of the Data Structure Investigator (DSI) project, which received financial support by the
* German Research Foundation (DFG) under grant no. L... | uniba-swt/DSIsrc | src/entrypoint/IDsOliEntryPointCreator.scala | Scala | gpl-3.0 | 1,525 |
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.