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 com.olegych.scastie.client.components.editor
import com.olegych.scastie.client.components._
import com.olegych.scastie.api
import japgolly.scalajs.react.extra.Reusability
object EditorReusability {
implicit val reusability: Reusability[Editor] =
Reusability.caseClass[Editor]
implicit val problemAnno... | OlegYch/scastie | client/src/main/scala/com.olegych.scastie.client/components/editor/EditorReusability.scala | Scala | apache-2.0 | 1,277 |
package com.gw.events.api
import akka.actor.ActorSystem
import akka.http.Http
import akka.http.server.Route.handlerFlow
import akka.stream.FlowMaterializer
import akka.util.Timeout
import com.gw.events.mongodb.MongoDbStorage
import com.typesafe.config.ConfigFactory
import reactivemongo.api.MongoDriver
import scala.co... | grzesiekw/events | events-api/src/main/scala/com/gw/events/api/Api.scala | Scala | apache-2.0 | 984 |
package net.fwbrasil.activate.json.jackson
import com.fasterxml.jackson.module.scala.deser.UntypedObjectDeserializerModule
import com.fasterxml.jackson.module.scala.IterableModule
import com.fasterxml.jackson.module.scala.MapModule
import com.fasterxml.jackson.module.scala.TupleModule
import com.fasterxml.jackson.modu... | avramirez/activate | activate-jackson/src/main/scala/net/fwbrasil/activate/json/jackson/ActivateScalaModule.scala | Scala | lgpl-2.1 | 1,107 |
package com.sksamuel.elastic4s.mappings
import org.elasticsearch.common.xcontent.XContentBuilder
import com.sksamuel.elastic4s.Analyzer
/** @author Fehmi Can Saglam */
object attributes {
sealed trait Attribute { self: TypedFieldDefinition =>
protected def insert(source: XContentBuilder): Unit
}
trait At... | maxcom/elastic4s | src/main/scala/com/sksamuel/elastic4s/mappings/attributes.scala | Scala | apache-2.0 | 16,042 |
/*
* sbt
* Copyright 2011 - 2018, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* Licensed under Apache License 2.0 (see LICENSE)
*/
package sbt.util
import sbt.io.IO
import sbt.io.syntax._
import CacheImplicits._
import sjsonnew.{ Builder, deserializationError, JsonFormat, Unbuilder }
import org.scalat... | xuwei-k/xsbt | util-cache/src/test/scala/SingletonCacheSpec.scala | Scala | apache-2.0 | 2,568 |
package com.overviewdocs.models
import java.sql.Timestamp
import com.overviewdocs.metadata.MetadataSchema
case class DocumentSet(
id: Long,
title: String,
query: Option[String],
public: Boolean,
createdAt: Timestamp,
documentCount: Int,
documentProcessingErrorCount: Int,
importOverflowCount: Int,
m... | overview/overview-server | common/src/main/scala/com/overviewdocs/models/DocumentSet.scala | Scala | agpl-3.0 | 842 |
object Test extends dotty.runtime.LegacyApp {
val x = M;
object M;
assert(x eq M)
}
| folone/dotty | tests/run/t405.scala | Scala | bsd-3-clause | 90 |
/**
* Copyright (c) 2017-2018 BusyMachines
*
* See company homepage at: https://www.busymachines.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.apac... | busymachines/busymachines-commons | effects-sync/src/test/scala/busymachines/effects/sync_test/OptionEffectsTest.scala | Scala | apache-2.0 | 16,465 |
package com.twitter.finatra.http.tests.server.controllers
import com.twitter.finagle.http.{MediaType, Request}
import com.twitter.finatra.http.Controller
import com.twitter.finatra.http.marshalling.response._
import com.twitter.finatra.http.tests.server.domain.{FormPostRequest, TestCaseClassWithHtml}
import com.twitte... | twitter/finatra | http-mustache/src/test/scala/com/twitter/finatra/http/tests/server/controllers/TestController.scala | Scala | apache-2.0 | 2,966 |
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
package io.scalaland.chimney.examples.pb.order
@SerialVersionUID(0L)
final case class Item(
id: _root_.scala.Int = 0,
name: _root_.scala.Predef.String = ""
)
| scalalandio/chimney | protos/src/test/scala/io.scalaland.chimney.examples.pb.order/Item.scala | Scala | apache-2.0 | 286 |
package io.youi.net
sealed trait PathPart extends Any {
def value: String
}
object PathPart {
private val ArgumentPartRegex1 = """[:](.+)""".r
private val ArgumentPartRegex2 = """[{](.+)[}]""".r
def apply(value: String): Option[PathPart] = value match {
case null | "" => None
case ".." => Some(UpLeve... | outr/youi | core/shared/src/main/scala/io/youi/net/PathPart.scala | Scala | mit | 1,279 |
package com.github.j5ik2o.reactive.redis
import java.util.concurrent.Executors
import org.scalatest.{ BeforeAndAfterAll, Suite }
import scala.collection.mutable.ArrayBuffer
import scala.concurrent.ExecutionContext
@SuppressWarnings(
Array("org.wartremover.warts.Null", "org.wartremover.warts.Var", "org.wartremover... | j5ik2o/reactive-redis | test/src/main/scala/com/github/j5ik2o/reactive/redis/RedisSpecSupport.scala | Scala | mit | 2,014 |
/**
* Copyright (C) 2010 Orbeon, Inc.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
*
* This program i... | ajw625/orbeon-forms | src/main/scala/org/orbeon/oxf/xforms/function/XFormsCase.scala | Scala | lgpl-2.1 | 1,331 |
package yang.flexmapping.datas
import java.lang.{Boolean, Short}
import org.apache.commons.lang3.time.FastDateFormat
import java.util.Date
/**
* Created by y28yang on 4/10/2016.
*/
abstract class DataHolder(val id: String, val value: String) {
def toOuterValue(outValueCreator: OutValueCreator): AnyRef
prot... | wjingyao2008/firsttry | NextGenAct/src/main/scala/yang/flexmapping/datas/DataHolder.scala | Scala | apache-2.0 | 2,866 |
package com.softwaremill.macwire.autocats
import scala.reflect.macros.blackbox
import cats.effect.{IO, Resource => CatsResource}
import com.softwaremill.macwire.internals._
object MacwireCatsEffectMacros {
private val log = new Logger()
def autowire_impl[T: c.WeakTypeTag](
c: blackbox.Context
)(dependenc... | adamw/macwire | macrosAutoCats/src/main/scala/com/softwaremill/macwire/autocats/MacwireAutoCatsMacros.scala | Scala | apache-2.0 | 5,810 |
/*
* Copyright (c) 2012-2015 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.apach... | thebeansgroup/snowplow | 3-enrich/scala-hadoop-enrich/project/Dependencies.scala | Scala | apache-2.0 | 4,344 |
package org.jetbrains.plugins.scala.failed.resolve
import org.jetbrains.plugins.scala.PerfCycleTests
import org.junit.experimental.categories.Category
/**
* Created by kate on 3/25/16.
*/
@Category(Array(classOf[PerfCycleTests]))
class OverloadedResolutionTest extends FailedResolveTest("overloadedResolution") {
... | jastice/intellij-scala | scala/scala-impl/test/org/jetbrains/plugins/scala/failed/resolve/OverloadedResolutionTest.scala | Scala | apache-2.0 | 436 |
package com.github.vitalsoftware.scalaredox.models
import org.joda.time.DateTime
import com.github.vitalsoftware.util.JsonImplicits.jodaISO8601Format
import com.github.vitalsoftware.macros._
import com.github.vitalsoftware.util.RobustPrimitives
/**
* Advance directive documents that the healthcare organization has o... | vital-software/scala-redox | src/main/scala/com/github/vitalsoftware/scalaredox/models/AdvanceDirective.scala | Scala | mit | 1,638 |
package org.jetbrains.plugins.scala
package lang
package psi
package stubs
package elements
import com.intellij.psi.PsiElement
import com.intellij.psi.stubs.{IndexSink, StubElement, StubInputStream, StubOutputStream}
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.templates.ScTemplateBody
import org.jetbrains... | triggerNZ/intellij-scala | src/org/jetbrains/plugins/scala/lang/psi/stubs/elements/ScTemplateBodyElementType.scala | Scala | apache-2.0 | 1,330 |
// scalac: -Xsource:2.13
import q.X._
package p {
object Test {
def main(args: Array[String]): Unit = println {
// both defined in p in other unit, and imported from q.X = ambiguous
f() + g()
}
}
}
package q {
object X { def f = "bye" ; def g = "hi" }
}
| scala/scala | test/files/neg/t2458c/test.scala | Scala | apache-2.0 | 281 |
package com.cterm2.mcfm1710
import net.minecraftforge.fluids
import utils.LocalTranslationUtils._
import net.minecraft.init.{Blocks => VanillaBlocks}
import net.minecraft.block.material.Material
import net.minecraft.world.{World, IBlockAccess}
import net.minecraft.util.IIcon
import net.minecraft.client.renderer.textur... | Pctg-x8/fluidMechanics | src/Fluids.scala | Scala | lgpl-2.1 | 1,554 |
package com.bostontechnologies.quickfixs.messages
import quickfix.Message
import quickfix.field._
class RichMessage private[messages](val self: Message) extends RichFieldMap[Message] {
require(self != null)
def messageType: String = RichMessage.messageType(self)
def messageType_=(value: String){
self.getHeade... | Forexware/quickfixs | src/main/scala/com/bostontechnologies/quickfixs/messages/RichMessage.scala | Scala | apache-2.0 | 3,104 |
/*
Copyright 2014 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
distr... | tdyas/scalding | scalding-hadoop-test/src/test/scala/com/twitter/scalding/platform/PlatformTest.scala | Scala | apache-2.0 | 28,932 |
package vanadis.modules.examples.scalacalc.mul
import vanadis.modules.examples.scalacalc.calcservices.Multiplier
import vanadis.ext.{Module, Expose}
@Module { val moduleType = "scalacalc-mul" }
class MultiplicationModule {
@Expose
def getMultiplier() : Multiplier = new MyMultiplier()
}
| kjetilv/vanadis | modules/examples/scalacalc/mul/src/main/scala/vanadis/modules/examples/scalacalc/mul/MultiplicationModule.scala | Scala | apache-2.0 | 294 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | ueshin/apache-spark | sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/state/StreamingSessionWindowStateManagerSuite.scala | Scala | apache-2.0 | 7,276 |
/**
* Created on: Dec 7, 2013
*/
package com.iteamsolutions.angular.models.atom
import scalaz.{
Failure => _,
Success => _,
_
}
/**
* The '''Feed''' type is a container of [[models.atom.Entry]] instances and
* is a simplified version of the
* [[http://www.ietf.org/rfc/rfc4287.txt Atom Feed Document]] speci... | osxhacker/angular-codegen | src/main/scala/com/iteamsolutions/angular/models/atom/Feed.scala | Scala | bsd-2-clause | 554 |
package controllers
import play.api.mvc.{Action, Controller}
import models.ProductObj
import models.{RedirectModel,RedirectsTable}
import play.api.mvc._
import play.api.mvc.Flash
import play.api.data._
import play.api.data.Form
import play.api.data.Forms._
import play.api.data.Forms.{mapping, longNumber, nonEmptyText}... | iamanandkris/RedirectURL | app/controllers/Redirects.scala | Scala | apache-2.0 | 3,137 |
package io.eels.component.hive
/**
* Strategy responsible for the filenames created by eel when writing out data.
*/
trait FilenameStrategy {
def filename: String
}
object DefaultFilenameStrategy extends FilenameStrategy {
override def filename: String = "eel_" + System.nanoTime()
}
| sksamuel/hadoop-streams | eel-hive/src/main/scala/io/eels/component/hive/FilenameStrategy.scala | Scala | apache-2.0 | 294 |
/**
* Copyright 2011-2017 GatlingCorp (http://gatling.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 appli... | MykolaB/gatling | gatling-core/src/test/scala/io/gatling/core/stats/writer/ResponseMessageSpec.scala | Scala | apache-2.0 | 1,098 |
class SQ {
val isEmpty = false
val get = Array(1)
}
object A {
def unapplySeq(a: Int): SQ = new SQ
}
object Main {
def main(args: Array[String]): Unit = {
val seq: Seq[Int] = 2 match {
case A(xs*) => xs // error // error
}
}
}
| dotty-staging/dotty | tests/neg/i4922.scala | Scala | apache-2.0 | 252 |
package algorithms.classification.logisticregression
/**
* User: Sudharshan
* Date: 8/19/13
* Time: 3:14 PM
*/
class LogisticRegression(n: Int) {
var weights = new Array[Double](n)
var rate: Double = 0.001
var ITERATIONS: Int = 3000
def sigmoid(z: Double) = {
1 / (1 + Math.exp(-z))
}
def train(i... | rsudharshan/DataScienceWithScala | app/algorithms/classification/logisticregression/LogisticRegression.scala | Scala | gpl-2.0 | 1,178 |
package stainless.algebra
import stainless.annotation._
@library
abstract class BoundedMeetSemilattice[A] extends MeetSemilattice[A] {
def one: A
@law
def law_identity(x: A): Boolean = {
meet(x, one) == x
}
}
@library
object BoundedMeetSemilattice {
def andSemilattice: BoundedMeetSemilattice[Boolean] ... | epfl-lara/stainless | frontends/algebra/src/main/stainless/algebra/BoundedMeetSemilattice.scala | Scala | apache-2.0 | 450 |
package com.tritondigital.consul.http.client
import com.ning.http.client.AsyncHttpClient
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
class ConsulHttpClient(extractNodes: String => Seq[Node]) {
val httpClient = new AsyncHttpClient()
def listNodes(service: String, ho... | tritondigital/ConsulHttpClient | src/main/scala/com/tritondigital/consul/http/client/ConsulHttpClient.scala | Scala | mit | 860 |
package mem
import org.scalajs.dom
import org.scalajs.dom.Element
import rx._
import rx.core.Obs
import scala.util.{Failure, Success}
import scalatags.JsDom.all._
/**
* A minimal binding between Scala.Rx and Scalatags and Scala-Js-Dom
*/
object Framework {
/**
* Wraps reactive strings in spans, so they can b... | jailjones/topix | web/ui/app/Framework.scala | Scala | apache-2.0 | 1,596 |
package squants.electro
import squants.QuantityParseException
import squants.space.Meters
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
/**
* @author Nicolas Vinuesa
* @since 1.4
*
*/
class ElectricFieldStrengthSpec extends AnyFlatSpec with Matchers {
behavior of "... | typelevel/squants | shared/src/test/scala/squants/electro/ElectricFieldStrengthSpec.scala | Scala | apache-2.0 | 1,924 |
package org.jetbrains.plugins.scala
package lang
package psi
package api
package toplevel
import org.jetbrains.plugins.scala.lang.psi.api.base.ScStableCodeReferenceElement
import org.jetbrains.plugins.scala.lang.psi.api.statements.ScDeclaredElementsHolder
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typede... | loskutov/intellij-scala | src/org/jetbrains/plugins/scala/lang/psi/api/toplevel/ScPackaging.scala | Scala | apache-2.0 | 1,036 |
package core
import io.apibuilder.spec.v0.models.{Contact, Info, License}
import lib.VersionTag
import org.scalatest.{FunSpec, Matchers}
class InfoSpec extends FunSpec with Matchers {
describe("with info") {
val baseJson = """
{
"name": "API Builder",
"apidoc": {
"version": "0.9.7"
... | apicollective/apibuilder | core/src/test/scala/core/InfoSpec.scala | Scala | mit | 2,040 |
/*
* 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.a... | janeefting/snowplow | 2-collectors/scala-stream-collector/src/main/scala/com.snowplowanalytics.snowplow.collectors.scalastream/CollectorService.scala | Scala | apache-2.0 | 6,055 |
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Enterprise Data Management Council
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation... | edmcouncil/rdf-serializer | src/test/scala/org/edmcouncil/rdf_toolkit/SesameSortedWriterSpecSupport.scala | Scala | mit | 14,090 |
package com.sksamuel.elastic4s
import org.elasticsearch.action.get.GetResponse
import org.elasticsearch.client.{Client, Requests}
import org.elasticsearch.index.VersionType
import org.elasticsearch.index.get.GetField
import org.elasticsearch.search.fetch.source.FetchSourceContext
import org.scalactic.{ErrorMessage, Or... | sjoerdmulder/elastic4s | elastic4s-core/src/main/scala/com/sksamuel/elastic4s/GetDsl.scala | Scala | apache-2.0 | 5,363 |
/*******************************************************************************
* This is part of fopltlmon (https://github.com/kaihornung/fopltlmon).
*
* Copyright (c) 2015 by Kai Hornung <development@khornung.com>
*
* Fopltlmon is free software: you can redistribute it and/or modify
* it under the term... | KaiHornung/fopltlmon | src/main/scala/datatype/Structure.scala | Scala | gpl-3.0 | 2,291 |
package uk.gov.gds.common.http.calendar
import uk.gov.gds.common.http.ApacheHttpClient
import uk.gov.gds.common.config.Config
object CalendarHttpClient extends ApacheHttpClient {
private[http] def targetUrl(path: String) = Config("calendar.api.url", "https://www.gov.uk/bank-holidays.json") + path
}
| alphagov/gds-scala-common | govuk-clients/src/main/scala/uk/gov/gds/common/http/calendar/CalendarHttpClient.scala | Scala | mit | 304 |
package com.github.j5ik2o.reactive.redis.parser
import com.github.j5ik2o.reactive.redis.parser.model._
import fastparse.byte.all._
@SuppressWarnings(
Array(
"org.wartremover.warts.Product",
"org.wartremover.warts.Serializable",
"org.wartremover.warts.Equals",
"org.wartremover.warts.EitherProjectionP... | j5ik2o/reactive-redis | core/src/main/scala/com/github/j5ik2o/reactive/redis/parser/ByteParsers.scala | Scala | mit | 4,196 |
/***********************************************************************
* Copyright (c) 2013-2016 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 is ... | mdzimmerman/geomesa | geomesa-convert/geomesa-convert-json/src/test/scala/org/locationtech/geomesa/convert/json/JsonConverterTest.scala | Scala | apache-2.0 | 35,937 |
package fim
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext.rddToPairRDDFunctions
object Apriori {
def main(args: Array[String]): Unit = {
val support_percent = 0.85
val fim_c = 8
val conf = new SparkConf().setAppName("fim").setMaster("local")... | iaalm/Spark_FIM | fim/Apriori.scala | Scala | mit | 853 |
/*
* 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 ... | tillrohrmann/flink | flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/expressions/CompositeAccessTest.scala | Scala | apache-2.0 | 4,432 |
package collins.permissions
import play.api.Logger
case class Privileges(users: Users, permissions: Permissions) {
private val logger = Logger("Privileges")
def userHasPermission(username: String, subject: String): Boolean = {
if (!sm(permissions.users, username).contains(subject.toLowerCase)) {
// use... | Shopify/collins | app/collins/permissions/Privileges.scala | Scala | apache-2.0 | 1,579 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | mahak/spark | mllib/src/main/scala/org/apache/spark/ml/classification/GBTClassifier.scala | Scala | apache-2.0 | 17,738 |
package dotty.tools.dotc
package transform
import core._
import Types._
import Symbols._
import Contexts._
import Phases._
import Flags._
import StdNames._
import SymUtils._
/** Methods that apply to user-defined value classes */
object ValueClasses {
def isDerivedValueClass(sym: Symbol)(using Context): Boolean = ... | dotty-staging/dotty | compiler/src/dotty/tools/dotc/transform/ValueClasses.scala | Scala | apache-2.0 | 2,020 |
import sbt._
import Keys._
object Dependencies {
lazy val scalaTest = "org.scalatest" %% "scalatest" % "2.1.7"
lazy val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.11.6"
lazy val parserCombinators = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.2"
lazy val macroParadise = "org.scalamacro... | phaller/pickling | project/Dependencies.scala | Scala | bsd-3-clause | 581 |
/*
* 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 ... | fhueske/flink | flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/runtime/stream/table/GroupWindowITCase.scala | Scala | apache-2.0 | 20,633 |
/*
* scala-swing (https://www.scala-lang.org)
*
* Copyright EPFL, Lightbend, Inc., contributors
*
* 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... | scala/scala-swing | src/main/scala/scala/swing/Table.scala | Scala | apache-2.0 | 15,965 |
package com.twitter.finatra.kafka.test.integration
import com.twitter.finagle.Init
import com.twitter.finagle.context.Contexts
import com.twitter.finagle.filter.PayloadSizeFilter.ClientReqTraceKey
import com.twitter.finagle.stats.NullStatsReceiver
import com.twitter.finagle.stats.StatsReceiver
import com.twitter.finag... | twitter/finatra | kafka/src/test/scala/com/twitter/finatra/kafka/test/integration/FinagleKafkaProducerIntegrationTest.scala | Scala | apache-2.0 | 12,693 |
package controllers
import models._
import play.api.data.Forms._
import play.api.mvc._
object Favourites extends Controller with ProvidesHeader with Secured {
def toggle(stationId: Int) = IsAuthenticated { user =>
request =>
models.Favourites.find(Favourite(user.email, stationId)).map {
models.Fa... | tegonal/hydroapp | app/controllers/Favourites.scala | Scala | lgpl-3.0 | 472 |
package me.enkode.j8
import java.util.Optional
import org.scalatest.{Matchers, FlatSpec}
class JavaOptionalSupportTest extends FlatSpec with Matchers {
case class Fixture(jOptional: Optional[String]) extends JavaOptionalSupport[String]
"JavaOptionalSupport" should "be able to convert a java Optional to a scala ... | kender/java8-converters | src/test/scala/me/enkode/j8/JavaOptionalSupportTest.scala | Scala | mit | 598 |
package io.atal.butterfly.action
import io.atal.butterfly.{Editor, Clipboard}
/** Implement the action Undo
* Undo the last action on the buffer
*/
class Undo extends Action {
/** Execute the action
*
* @param editor The editor onto the action is executed
* @param clipboard The clipboard onto the a... | Matthieu-Riou/Butterfly | src/main/scala/io/atal/butterfly/action/Undo.scala | Scala | mit | 419 |
package rpgboss.editor.cache
import rpgboss.editor.StateMaster
import com.google.common.cache._
import rpgboss.model._
import rpgboss.model.resource._
import java.awt.image.BufferedImage
class EventImageCache(sm: StateMaster)
extends CacheLoader[SpriteSpec, BufferedImage] {
val cache = CacheBuilder.newBuilder()
... | toastythought/rpgboss | editor/src/main/scala/rpgboss/editor/cache/EventImageCache.scala | Scala | agpl-3.0 | 1,045 |
package org.jetbrains.plugins.scala
package lang.refactoring.rename
import java.util
import com.intellij.psi.{PsiElement, PsiReference}
import com.intellij.refactoring.rename.RenamePsiElementProcessor
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiUtil
import org.jetbrains.plugins.scala.lang.psi.api.base.pattern... | katejim/intellij-scala | src/org/jetbrains/plugins/scala/lang/refactoring/rename/RenameScalaBindingPatternProcessor.scala | Scala | apache-2.0 | 1,094 |
package org.jetbrains.plugins.scala
package lang
package surroundWith
package surrounders
package expression
import com.intellij.lang.ASTNode
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import org.jetbrains.plugins.scala.lang.psi.ScalaPsiUtil
import org.jetbrains.plugins.scala.lang.ps... | jastice/intellij-scala | scala/scala-impl/src/org/jetbrains/plugins/scala/lang/surroundWith/surrounders/expression/ScalaWithTryCatchFinallySurrounder.scala | Scala | apache-2.0 | 1,541 |
package dnd5_dm_db
package lang.eng
import dnd5_dm_db.lang.Lang
import dnd5_dm_db.model._
trait SpellText extends lang.SpellText {
self : Lang =>
val castingTime: String = "Casting Time"
val components : String = "Components"
val duration: String = "Duration"
val concentration : String = "Concentration"... | lorilan/dnd5_dm_db | src/main/scala/dnd5_dm_db/lang/eng/SpellText.scala | Scala | gpl-3.0 | 1,241 |
package org.denigma.threejs.extensions
import org.denigma.threejs.extensions.controls.{ HoverControls, CameraControls }
import org.denigma.threejs.extras.HtmlRenderer
import org.denigma.threejs.{ Scene, WebGLRendererParameters, WebGLRenderer }
import org.scalajs.dom.{ MouseEvent, Event }
import scala.scalajs.j... | antonkulaga/threejs-facade | facade/src/main/scala/org/denigma/threejs/extensions/Container3D.scala | Scala | mpl-2.0 | 1,923 |
/**
* Copyright 2015 ICT.
*
* 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
... | DataSysLab/netflow | common/src/main/scala/cn/ac/ict/acs/netflow/ha/NetFlowCuratorUtil.scala | Scala | apache-2.0 | 2,299 |
package io.github.jamespic.ethereum_tools.decompiler.control_flow
object GraphRewriteRules {
def doSafeRewrites(graph: ControlGraph): ControlGraph = {
findSafeRewrite(graph) match {
case Some(x) => doSafeRewrites(x)
case None => graph
}
}
def tryUnsafeRewrites(graph: ControlGraph): Stream[Con... | jamespic/ethereum-tools | src/main/scala/io.github.jamespic.ethereum_tools/decompiler/control_flow/GraphRewriteRules.scala | Scala | mit | 3,116 |
object MainAp extends App{
case class Person(val name:String,val age:Int)
val people: List[Person] = List(Person("Diego",36),Person("Andressa",36),Person("Melina",6),Person("Gandalf",6))
// Partition `people` into two arrays `minors` and `adults`.
// Use the anonymous function `(_.age < 18)` as a predicate ... | diegopacheco/scala-playground | scala-2.13.4-sbt-1.4.0-fun/src/main/scala/com/github/diegopacheco/scalaplayground/main/MainApp.scala | Scala | unlicense | 441 |
package xyz.jmullin.drifter.assets
/**
* Information on the location and file type of an asset to be loaded into the application.
*
* @param pathPrefix Prefix from the assets root where the asset can be found.
* @param fileSuffix File extension to use in loading the asset file.
*/
case class AssetType(pathPrefix:... | JustinMullin/drifter | src/main/scala/xyz/jmullin/drifter/assets/AssetType.scala | Scala | mit | 348 |
package panop.web.workers
import akka.actor._
import scala.util.{ Try, Success, Failure }
import scalaj.http._
import panop.web.models.MResult
import panop.web.common.Settings
import panop._
/**
* Extracts data and do a local search once at a time.
* @author Mathieu Demarne (mathieu.demarne@gmail.com)
*/
class ... | mdemarne/panop-web | app/workers/Persistence.scala | Scala | apache-2.0 | 1,099 |
/*
* Tranquility.
* Copyright 2013, 2014, 2015 Metamarkets Group, 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... | deepikakhera/spark-tranquility | core/src/main/scala/com/metamx/tranquility/finagle/FinagleRegistry.scala | Scala | apache-2.0 | 3,682 |
package chrome.events
class MappedEventSource[A, B](source: EventSource[A], map: A => B) extends EventSource[B] {
def listen(fn: B => Unit): Subscription = {
source.listen(map.andThen(fn))
}
}
| amsayk/scala-js-chrome | bindings/src/main/scala/chrome/events/MappedEventSource.scala | Scala | mit | 205 |
package com.github.tototoshi.play2.auth
import play.api.mvc.{DiscardingCookie, Cookie, Result, RequestHeader}
class CookieTokenAccessor(
protected val cookieName: String = "PLAY2AUTH_SESS_ID",
protected val cookieSecureOption: Boolean = false,
protected val cookieHttpOnlyOption: Boolean = true,
protec... | tototoshi/play2-auth | module/src/main/scala/com/github/tototoshi/play2/auth/CookieTokenAccessor.scala | Scala | apache-2.0 | 1,048 |
package ch.wsl.box.client.styles
import scalacss.ProdDefaults._
object OpenLayersStyles extends StyleSheet.Inline {
import dsl._
val olStyle = style(
unsafeRoot(".ol-control button")(
backgroundColor(c"rgba(108, 117, 125, 0.8)"),
&.hover(
backgroundColor(c"#5a6268"),
)
),
u... | Insubric/box | client/src/main/scala/ch/wsl/box/client/styles/OpenLayersStyles.scala | Scala | apache-2.0 | 796 |
/**
* Copyright (c) 2007-2011 Eric Torreborre <etorreborre@yahoo.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights ... | Muki-SkyWalker/specs | src/test/scala/org/specs/matcher/beMatcherSpec.scala | Scala | mit | 4,951 |
package lila.importer
import chess._
import chess.Pos._
import org.specs2.mutable._
import org.specs2.specification._
import ornicar.scalalib.test._
class DataFormTest extends Specification with ScalazValidationMatchers {
"Import from position" should {
"preserve initial FEN" in {
val pgn = """[Event "C... | clarkerubber/lila | modules/importer/src/test/DataFormTest.scala | Scala | agpl-3.0 | 1,060 |
// Copyright (c) 2011-2015 ScalaMock Contributors (https://github.com/paulbutcher/ScalaMock/graphs/contributors)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, in... | hypertino/ScalaMock | examples/shared/src/main/scala/com/example/Order.scala | Scala | mit | 1,483 |
package edu.chop.cbmi.dataExpress.backends.file
import java.io.File
import edu.chop.cbmi.dataExpress.dataModels.{DataType, DataRow, ColumnNameGenerator}
import edu.chop.cbmi.dataExpress.dataModels.sql._
import scala.io.Source
import scala.annotation.tailrec
import scala.collection.immutable
import scala.util.matching.... | chop-dbhi/dataexpress | src/main/scala/edu/chop/cbmi/dataExpress/backends/file/MagicMarshaller.scala | Scala | bsd-2-clause | 13,760 |
object Test {
trait A extends AnyRef {
def f : Int = 1
}
class B extends AnyRef with A {
override def f : Int = super[A].f
}
def main(args: Array[String]) =
Console.println(new B().f);
}
| yusuke2255/dotty | tests/untried/pos/michel2.scala | Scala | bsd-3-clause | 215 |
package org.scalatest.tools
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class FriendlyParamsTranslatorSuite extends FunSuite {
private def parsePropsAndTags(rawargs:String) = {
val translator = new FriendlyParamsTranslato... | yyuu/scalatest | src/test/scala/org/scalatest/tools/FriendlyParamsTranslatorSuite.scala | Scala | apache-2.0 | 18,601 |
/*
* 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 ... | agoncharuk/ignite | modules/spark/src/main/scala/org/apache/ignite/spark/impl/IgniteAbstractRDD.scala | Scala | apache-2.0 | 1,489 |
package at.forsyte.apalache.tla.pp
import at.forsyte.apalache.tla.lir.TlaOperDecl
import at.forsyte.apalache.tla.lir.convenience._
import at.forsyte.apalache.tla.lir.transformations.impl.TrackerWithListeners
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.{BeforeAndAfterEach... | konnov/dach | tla-pp/src/test/scala/at/forsyte/apalache/tla/pp/TestExprOptimizer.scala | Scala | apache-2.0 | 7,056 |
package com.eevolution.context.dictionary.infrastructure.repository
import com.eevolution.context.dictionary.domain.model.Process
import com.eevolution.context.dictionary.infrastructure.db.DbContext._
/**
* Copyright (C) 2003-2017, e-Evolution Consultants S.A. , http://www.e-evolution.com
* This program is free s... | adempiere/ADReactiveSystem | dictionary-impl/src/main/scala/com/eevolution/context/dictionary/infrastructure/repository/ProcessMapping.scala | Scala | gpl-3.0 | 2,481 |
/*
* 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... | jenniew/BigDL | spark/dl/src/main/scala/com/intel/analytics/bigdl/nn/Reshape.scala | Scala | apache-2.0 | 6,527 |
package org.hawkular.ircbot
import org.pircbotx.{Configuration, PircBotX}
/**
* @author Jirka Kremser
*
*/
class IrcLogBot(config: Configuration[ _ <: PircBotX], listener: IrcBotListener) extends PircBotX(config) {
val TRUSTSTORE_NAME = "cacerts.jks"
def IrcLogBot(bot: IrcBotListener) {
setNick(System.ge... | Jiri-Kremser/ircLogBot | ircLogBot/src/main/scala/org/hawkular/ircbot/IrcLogBot.scala | Scala | apache-2.0 | 1,481 |
package scaladex.client
import org.scalajs.dom.Node
import org.scalajs.dom.document
import org.scalajs.dom.raw.Element
import org.scalajs.dom.raw.HTMLInputElement
import scaladex.core.api.AutocompletionRequest
object Dom {
def getSearchRequest: Option[AutocompletionRequest] =
for (query <- getSearchQuery)
... | scalacenter/scaladex | modules/webclient/src/main/scala/scaladex/client/Dom.scala | Scala | bsd-3-clause | 1,712 |
/*
* 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 ... | practice-vishnoi/dev-spark-1 | external/twitter/src/main/scala/org/apache/spark/streaming/twitter/TwitterInputDStream.scala | Scala | apache-2.0 | 3,943 |
/***
* Copyright 2017 Rackspace US, 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 applica... | wdschei/api-checker | core/src/main/scala/com/rackspace/com/papi/components/checker/servlet/ParsedJSON.scala | Scala | apache-2.0 | 1,086 |
package com.github.dzhg.tedis.storage
/**
* @author dzhg 8/11/17
*/
trait LockedStorage {
def withoutLock[T](block: TedisStorage => T): T
def withLock[T](block: TedisStorage => T): T
def withLockUnit(block: TedisStorage => Unit): Unit
}
trait LockedMapStorage extends LockedStorage {
private val internal... | dzhg/tedis | src/main/scala/com/github/dzhg/tedis/storage/LockedStorage.scala | Scala | mit | 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 ... | tzulitai/flink | flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/api/batch/sql/CalcTest.scala | Scala | apache-2.0 | 2,615 |
object Test extends App {
val emptyTuple: Tuple = Tuple()
val tuple1: Tuple = ("1", "2", "3", "4", "5")
val tuple2: Tuple = ("6", "7", "8", "9", "10")
val tupleXXL1: Tuple = ("11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33"... | dotty-staging/dotty | tests/run/tuple-zip.scala | Scala | apache-2.0 | 870 |
object PartialFunction {
def takesLambda(fn: Int => Int) = ???
def takesPartial(fn: PartialFunction[Int, Int]) = ???
val fn1: Int => Int = {
case 1 => 2
}
val fn2: PartialFunction[Int, Int] = {
case 2 => 3
}
takesLambda({
case 3 => 4
})
takesPartial({
case 4 => 5
})
def lam0(fn: ()... | mdemarne/scalahost | tests/src/test/resources/ScalaToMeta/PartialFunction/Expected.scala | Scala | bsd-3-clause | 505 |
package actors
import akka.actor.ActorRef
object PrivateActorMessages {
case class IdAllocatorActorRef(ref: ActorRef)
case class CreateWorkflowExtended(wfDefName: String, label: String, id: Int)
case object ExecuteRound
case object AllocateIdBlock
case class AllocatedIdBlock(identifiers: Seq[Int])
}
| mpod/scala-workflow | backend/src/main/scala/actors/PrivateActorMessages.scala | Scala | gpl-3.0 | 314 |
/*
* Copyright 2014 Databricks
*
* 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 i... | CrazyJacky/spark-avro | src/test/scala/com/databricks/spark/avro/AvroReadBenchmark.scala | Scala | apache-2.0 | 2,055 |
/*
* 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/application/exemption/partner/PartnerPermanentHomeQuestionViewTest.scala | Scala | apache-2.0 | 2,310 |
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "cors"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
// Add your project dependencies here,
// jdbc,
// anorm
)
val main = play.Project(appName, appVersion, appDepend... | karolchmist/play-scala-angular-cors-prototype | server/project/Build.scala | Scala | mit | 393 |
package mesosphere.marathon
package state
trait Timestamped { def version: Timestamp }
object Timestamped {
/**
* Returns an ordering on type `T` derived from the natural ordering of
* the `T`'s timestamps.
*/
def timestampOrdering[T <: Timestamped](): Ordering[T] = Ordering.by(_.version)
}
| guenter/marathon | src/main/scala/mesosphere/marathon/state/Timestamped.scala | Scala | apache-2.0 | 311 |
package sri.mobile.examples.uiexplorer.components.ios
import org.scalajs.dom
import sri.core.ElementFactory._
import sri.core.ReactComponent
import sri.mobile.components.ios.{ActivityIndicatorIOS, ActivityIndicatorIOSSize}
import sri.mobile.examples.uiexplorer.{UIExample, UIExplorerBlock, UIExplorerPage}
import sri.un... | hamazy/sri | mobile-examples/src/main/scala/sri/mobile/examples/uiexplorer/components/ios/ActivityIndicatorIOSExample.scala | Scala | apache-2.0 | 3,026 |
/*
* Copyright 2016 Uncharted Software 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 o... | unchartedsoftware/salt | src/main/scala/software/uncharted/salt/core/generation/request/TileSeqRequest.scala | Scala | apache-2.0 | 1,100 |
package cz.kamenitxan.jakon.validation.validators
import java.lang.annotation.Annotation
import java.lang.reflect.Field
import java.text.ParseException
import java.time.format.DateTimeParseException
import java.time.{LocalDate, LocalDateTime}
import cz.kamenitxan.jakon.logging.Logger
import cz.kamenitxan.jakon.utils.... | kamenitxan/Jakon | modules/backend/src/main/scala/cz/kamenitxan/jakon/validation/validators/FutureValidator.scala | Scala | bsd-3-clause | 1,449 |
package org.jetbrains.plugins.scala.annotator
import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter
/**
* Created by kate on 3/29/16.
*/
class InfixTailRecursiveCall extends AnnotatorLightCodeInsightFixtureTestAdapter {
def testSCL8792(): Unit = {
checkTextHasNoErrors(
"""
... | JetBrains/intellij-scala | scala/scala-impl/test/org/jetbrains/plugins/scala/annotator/InfixTailRecursiveCall.scala | Scala | apache-2.0 | 762 |
/*
* 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/computations/CP16.scala | Scala | apache-2.0 | 907 |
package challenges.fp.introduction
object FilterPositionsInAList {
def f (arr: List[Int]): List[Int] = {
var i = 0
arr.filter( _ => { i+= 1; i % 2 == 0; } )
}
}
| chadwhiting/hacker-rank | src/main/scala/challenges/fp/introduction/FilterPositionsInAList.scala | Scala | gpl-3.0 | 174 |
/*
* Copyright (C) 2009-2018 Lightbend Inc. <https://www.lightbend.com>
*/
package play.api.db.evolutions
import org.specs2.mutable.Specification
import play.api.Configuration
class DefaultEvolutionsConfigParserSpec extends Specification {
def parse(config: (String, Any)*): EvolutionsConfig = {
new DefaultE... | Shenker93/playframework | framework/src/play-jdbc-evolutions/src/test/scala/play/api/db/evolutions/DefaultEvolutionsConfigParserSpec.scala | Scala | apache-2.0 | 3,559 |
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.