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 |
|---|---|---|---|---|---|
class ReaderWriter[T](private var content: T) {
def read: T = content
def write(x: T) { content = x }
}
| grzegorzbalcerek/scala-book-examples | examples/ReaderWriter.scala | Scala | mit | 108 |
package grammar
/**
* Created by Mikael on 13.08.2015.
* Will save the current grammar to the given field
*/
object GrammarSave {
case object Reference extends GrammarSave
case object Initial extends GrammarSave
case object None extends GrammarSave
}
sealed trait GrammarSave
| epfl-lara/grammar-web | js/src/main/scala/grammar/GrammarSave.scala | Scala | mit | 286 |
/*
* 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 ... | ueshin/apache-flink | flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/runtime/join/NonWindowInnerJoin.scala | Scala | apache-2.0 | 3,520 |
package uk.gov.dvla.auditing
object Status extends Enumeration {
val RecordFound,
NotFound = Value
}
| dvla/sdl-opensource | audit-core/src/main/scala/uk/gov/dvla/auditing/Status.scala | Scala | mit | 106 |
/* Copyright 2009-2016 EPFL, Lausanne */
package leon
package genc
import purescala.Common.{ Identifier }
import purescala.Definitions.{ Definition, FunDef, ValDef, Program }
import purescala.Types.{ TypeTree }
/*
* Some type aliased for readability
*/
package object phases {
case class VarInfo(id: Identifier, ... | regb/leon | src/main/scala/leon/genc/phases/package.scala | Scala | gpl-3.0 | 465 |
/***********************************************************************
* Copyright (c) 2013-2017 Commonwealth Computer Research, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution and... | ronq/geomesa | geomesa-process/geomesa-process-vector/src/main/scala/org/locationtech/geomesa/process/analytic/UniqueProcess.scala | Scala | apache-2.0 | 11,312 |
// Copyright (C) 2019 MapRoulette contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
package org.maproulette.models.dal
import java.sql.Connection
import anorm._
import javax.inject.{Inject, Singleton}
import org.maproulette.Config
import org.maproulette.data.ProjectT... | Crashfreak/maproulette2 | app/org/maproulette/models/dal/VirtualProjectDAL.scala | Scala | apache-2.0 | 3,541 |
package TAPL
import TAPL.Util._
object EquiRec {
trait Alg[E, T] extends Typed.Alg[E, T] with RecType.Alg[T] with TypeVar.Alg[T]
trait Print extends Alg[String, String] with Typed.Print with RecType.Print with TypeVar.Print
trait Parser[E, T, L <: {val pE : Util.PackratParser[E]; val pT : Util.PackratParser[... | hy-zhang/parser | Scala/Old/TAPL/EquiRec.scala | Scala | bsd-3-clause | 975 |
/*
* 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 | yggdrasil/src/main/scala/quasar/yggdrasil/jdbm3/StdCodecs.scala | Scala | apache-2.0 | 4,128 |
package filodb.memory.format
import java.nio.ByteBuffer
import java.sql.Timestamp
import scala.reflect.ClassTag
import org.agrona.DirectBuffer
import org.agrona.concurrent.UnsafeBuffer
import org.joda.time.DateTime
import spire.syntax.cfor._
import filodb.memory.format.vectors.Histogram
/**
* A generic trait for ... | filodb/FiloDB | memory/src/main/scala/filodb.memory/format/RowReader.scala | Scala | apache-2.0 | 19,682 |
package org.mbs3.elasticsearch.irc
import org.pircbotx._
import org.pircbotx.hooks._
import org.pircbotx.hooks.events._
import org.mbs3.elasticsearch.irc.commands.CommandListener
object ElasticsearchBot extends App {
val config = new Configuration.Builder()
.setName("martin_esbot")
.setLogin("elasticsearc... | martinb3/capek | src/main/scala/org/mbs3/elasticsearch/irc/ElasticsearchBot.scala | Scala | apache-2.0 | 809 |
package ch.epfl.scala.index
package server
package routes
package api
package impl
import data._
import data.cleanup.GithubRepoExtractor
import data.download.PlayWsDownloader
import data.elastic._
import data.github._
import data.maven.{MavenModel, PomsReader, DownloadParentPoms}
import data.project.ProjectConvert
im... | adamwy/scaladex | server/src/main/scala/ch.epfl.scala.index.server/routes/api/impl/PublishProcess.scala | Scala | bsd-3-clause | 6,556 |
package com.navercorp.graph
import scala.collection.mutable.ArrayBuffer
object GraphOps {
def setupAlias(nodeWeights: Array[(Long, Double)]): (Array[Int], Array[Double]) = {
val K = nodeWeights.length
val J = Array.fill(K)(0)
val q = Array.fill(K)(0.0)
val smaller = new ArrayBuffer[Int]()
val l... | aditya-grover/node2vec | node2vec_spark/src/main/scala/com/navercorp/graph/GraphOps.scala | Scala | mit | 1,915 |
package chapter.three
import ExerciseOne.randomNaturalNumbers
import org.scalatest._
import org.scalatest.junit.JUnitRunner
import org.junit.runner.RunWith
@RunWith(classOf[JUnitRunner])
class ExerciseOneSpec extends FlatSpec with Matchers {
// todo: make unit test more rubust
"randomNaturalNumbers" should "ret... | deekim/impatient-scala | src/test/scala/chapter/three/ExerciseOneSpec.scala | Scala | apache-2.0 | 585 |
package org.kimbasoft.scala.codingstyle.functional.implicits
/**
* Missing documentation
*
* @since 1.0
*/
object Implicitly {
abstract class Decorator[T] {
def decorate(obj: T): String
}
implicit object StringDecorator extends Decorator[String] {
def decorate(obj: String): String = "$" + obj
}
... | kimba74/sandbox-scala | src/main/scala/org/kimbasoft/scala/codingstyle/functional/implicits/Implicitly.scala | Scala | gpl-3.0 | 1,964 |
package sri.sangria.web.mutations
import sri.relay.mutation.RelayMutation
import sri.relay.query.RelayQL
import sri.relay.tools.RangeAddMutationConfig
import sri.relay.tools.RelayTypes.{MutationFragment, RelayMutationConfig}
import scala.scalajs.js
import scala.scalajs.js.Dynamic.{literal => json}
import scala.scalaj... | chandu0101/sri-sangria-example | web/src/main/scala/sri/sangria/web/mutations/AddTodoMutation.scala | Scala | apache-2.0 | 1,328 |
package org.jetbrains.plugins.scala
package lang
package resolve
package processor
import com.intellij.openapi.util.Key
import com.intellij.psi._
import com.intellij.psi.scope._
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.plugins.scala.extensions._
imp... | katejim/intellij-scala | src/org/jetbrains/plugins/scala/lang/resolve/processor/ResolveProcessor.scala | Scala | apache-2.0 | 8,617 |
package com.twitter.util
import com.twitter.common.objectsize.ObjectSizeCalculator
import com.twitter.conversions.time._
import java.util.concurrent.ConcurrentLinkedQueue
import org.junit.runner.RunWith
import org.mockito.Matchers.any
import org.mockito.Mockito.{never, verify, when}
import org.mockito.invocation.Invoc... | n054/util | util-core/src/test/scala/com/twitter/util/FutureTest.scala | Scala | apache-2.0 | 50,236 |
package im.actor.server.api.http.json
sealed trait Content
case class Text(text: String) extends Content
case class Image(imageUrl: String) extends Content
case class Document(documentUrl: String) extends Content
case class Group(title: String, avatars: Option[AvatarUrls])
case class User(name: String, avatars: Optio... | chenbk85/actor-platform | actor-server/actor-http-api/src/main/scala/im/actor/server/api/http/json/models.scala | Scala | mit | 649 |
/*
* Copyright 2016 The BigDL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | intel-analytics/BigDL | scala/dllib/src/test/scala/com/intel/analytics/bigdl/dllib/nn/UtilsSpec.scala | Scala | apache-2.0 | 1,861 |
package controllers
import javax.inject.Inject
import com.mohiva.play.silhouette.api.{Environment, Silhouette}
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator
import forms.FeedbackForm
import models.User
import models.daos.drivers.GitHubAPI
import models.forms.QuickstartForm
import models.s... | gitlinks/gitrank-web | app/controllers/ApplicationController.scala | Scala | apache-2.0 | 12,665 |
package org.bitcoins.core.util.testprotocol
import org.bitcoins.core.crypto.{ ECPrivateKey, Sha256Hash160Digest }
import org.bitcoins.core.protocol.Address
import org.bitcoins.core.util.BitcoinSLogger
import spray.json._
/**
* Created by tom on 6/14/16.
*/
object Base58ValidTestCaseProtocol extends DefaultJsonProto... | Christewart/bitcoin-s-core | src/test/scala/org/bitcoins/core/util/testprotocol/Base58ValidTestCaseProtocol.scala | Scala | mit | 1,595 |
import api.Api
import core.BootedCore
import core.CorePlumbing
import web.Web
object taximeter extends App with BootedCore with CorePlumbing with Api with Web | opyate/taximeter | src/main/scala/RestApp.scala | Scala | mit | 159 |
package pmg.tutorials
import org.scalatest._
import akka.actor.ActorSystem
import akka.util.Timeout
import akka.testkit.TestActorRef
import scala.concurrent.duration._
import scala.concurrent.Await
import akka.pattern.ask
import scala.language.postfixOps
import scala.util.{Success => ScalaSuccess}
class SolvingActorS... | mcross1882/BruteForceAttack | src/test/scala/pmg/tutorials/SolvingActorSpec.scala | Scala | apache-2.0 | 1,488 |
/*
* Copyright 2001-2013 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this opt except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | travisbrown/scalatest | src/test/scala/org/scalatest/ShouldBeReadableStructuralLogicalAndSpec.scala | Scala | apache-2.0 | 16,738 |
package io.github.benfradet
//Example https://benfradet.github.io/blog/2015/12/16/Exploring-spark.ml-with-the-Titanic-Kaggle-competition
import org.apache.log4j.{Logger, Level}
import org.apache.spark.ml.Pipeline
import org.apache.spark.ml.classification.RandomForestClassifier
import org.apache.spark.ml.evaluation.B... | fclesio/learning-space | Scala/titanic.scala | Scala | gpl-2.0 | 8,001 |
package com.acme.ShoppingCart.helpers
/*
* Generates a Bearer Token with a length of
* 32 characters (MD5) or 64 characters (SHA-256) according to the
* specification RFC6750 (http://tools.ietf.org/html/rfc6750)
*
* Uniqueness obtained by by hashing system time combined with a
* application supplied 'tokenprefix... | prayagupd/finatra-angular-example | src/main/scala/com/acme/ShoppingCart/helpers/BearerTokenGeneratorHelper.scala | Scala | mit | 2,828 |
package ua.kpi.teacherjournal
import android.app.Fragment
import android.os.Bundle
import android.view.Surface
import org.scaloid.common._
trait RichFragment extends TagUtil { self: Fragment =>
implicit def ctx = getActivity
def arg[T](argName: String) =
getArguments.get(argName).asInstanceOf[T]
def setAr... | sochka/teacher-journal | src/ua/kpi/teacherjournal/RichFragment.scala | Scala | gpl-3.0 | 715 |
package scutil.lang
import minitest._
object IoDisposerTest extends SimpleTestSuite {
test("a combined Disposer should execute both actions in order") {
var tmp = ""
val a = IoDisposer delay { tmp = tmp + "a" }
val b = IoDisposer delay { tmp = tmp + "b" }
val c = a combine b
c.unsafeRun()
assertEquals(t... | ritschwumm/scutil | modules/core/src/test/scala/scutil/lang/IoDisposerTest.scala | Scala | bsd-2-clause | 1,559 |
/*
* Copyright 2017 Datamountaineer.
*
* 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... | CodeSmell/stream-reactor | kafka-connect-kudu/src/main/scala/com/datamountaineer/streamreactor/connect/kudu/config/KuduSettings.scala | Scala | apache-2.0 | 2,780 |
package slamdata.engine
import slamdata.engine.fp._
import slamdata.engine.std._
import slamdata.engine.sql._
import slamdata.engine.analysis._
import slamdata.engine.analysis.fixplate._
import slamdata.engine.physical.mongodb._
import slamdata.engine.fs._
import scalaz.{Node => _, Tree => _, _}
import scalaz.concurr... | mossprescott/quasar | src/main/scala/slamdata/engine/backend.scala | Scala | agpl-3.0 | 3,926 |
/*
* Copyright (C) 2013 Alcatel-Lucent.
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* Licensed to you 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 cop... | molecule-labs/molecule | molecule-net/src/main/scala/molecule/net/DatagramSocket.scala | Scala | apache-2.0 | 4,849 |
/*
*************************************************************************************
* Copyright 2011 Normation SAS
*************************************************************************************
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero Ge... | jooooooon/rudder | rudder-core/src/main/scala/com/normation/rudder/repository/ReportsRepository.scala | Scala | agpl-3.0 | 4,222 |
/*
* 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 ... | Intel-bigdata/CRF-Spark | src/main/scala/com/intel/ssg/bdt/nlp/CRF.scala | Scala | apache-2.0 | 5,226 |
///*
// active-learning-scala: Active Learning library for Scala
// Copyright (c) 2014 Davi Pereira dos Santos
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the... | active-learning/active-learning-scala | src/main/scala/al/strategies/GATU0.scala | Scala | gpl-2.0 | 2,854 |
/**
* 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... | shawjef3/kafka | core/src/test/scala/unit/kafka/producer/ProducerTest.scala | Scala | apache-2.0 | 13,638 |
/*
* Copyright 2016-2020 Daniel Urban and contributors listed in AUTHORS
* Copyright 2020 Nokia
* SPDX-License-Identifier: Apache-2.0
*
* 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
*... | durban/seals | tests/src/test/scala/dev/tauri/seals/tests/CompatSpec.scala | Scala | apache-2.0 | 3,608 |
package com.outr.arango.api
import com.outr.arango.api.model._
import io.youi.client.HttpClient
import io.youi.http.HttpMethod
import io.youi.net._
import io.circe.Json
import scala.concurrent.{ExecutionContext, Future}
object APIGharialGraphEdgeDefinition {
def delete(client: HttpClient, graph: String, defi... | outr/arangodb-scala | api/src/main/scala/com/outr/arango/api/APIGharialGraphEdgeDefinition.scala | Scala | mit | 1,404 |
class Person {
protected[this] var age = 0
def setAge(newAge: Int) { // A person can never get younger
if (newAge > age) age = newAge
}
}
class Manager extends Person {
protected var salary = 0.0
def setSalary(newSalary: Double) { // A manager's salary can never decrease
if (newSalary > salary) ... | yeahnoob/scala-impatient-2e-code | src/ch08/sec04/Manager.scala | Scala | gpl-3.0 | 971 |
package me.gregd.cineworld.integration.vue
import java.time.LocalDate
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import me.gregd.cineworld.domain.service.VueService
import me.gregd.cineworld.integration.tmdb.TmdbIntegrationService
import me.gregd.cineworld.integration.vue.VueIntegrationService... | Grogs/cinema-service | domain/src/test/scala/me/gregd/cineworld/integration/vue/VueServiceTest.scala | Scala | gpl-3.0 | 1,460 |
/*
* 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 ... | Aegeaner/spark | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala | Scala | apache-2.0 | 29,068 |
/*
* OpenURP, Open University Resouce Planning
*
* Copyright (c) 2013-2014, OpenURP Software.
*
* OpenURP is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your ... | openurp/edu-core | attendance/ws/src/main/scala/org/openurp/edu/attendance/ws/impl/SigninService.scala | Scala | gpl-3.0 | 5,536 |
package atari.st.tools
import atari.st.disk.{Disk, Duplicates, DuplicateStatus}
import atari.st.settings.Settings
import atari.st.util.Util
import java.io.{BufferedOutputStream, ByteArrayInputStream, FileOutputStream}
import java.nio.file.{Files, Path}
import scala.collection.mutable
import suiryc.scala.io.{FilesEx, I... | suiryc/atari-st-tools | src/main/scala/atari/st/tools/Deduplicator.scala | Scala | gpl-3.0 | 20,768 |
/*
* Copyright (c) 2011-2015 EPFL DATA Laboratory
* Copyright (c) 2014-2015 The Squall Collaboration (see NOTICE)
*
* 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... | epfldata/squall | squall-core/src/test/scala/HyracksTest.scala | Scala | apache-2.0 | 1,977 |
package com.thinkbiganalytics.spark.dataprofiler.function
import com.thinkbiganalytics.spark.dataprofiler.ProfilerConfiguration
import com.thinkbiganalytics.spark.dataprofiler.model.StandardStatisticsModel
import org.apache.spark.sql.types.StructField
/** Creates a statistics model from RDD values.
*
* @param sch... | peter-gergely-horvath/kylo | integrations/spark/spark-job-profiler/spark-job-profiler-core/src/main/scala/com/thinkbiganalytics/spark/dataprofiler/function/PartitionLevelModels.scala | Scala | apache-2.0 | 902 |
package controllers.sitedata.modality.th
import javax.inject._
import play.api._
import play.api.mvc._
import play.api.data.Form
import play.api.data.Forms._
import play.api.data._
import models.sitedata.SiteInfo
//import models.sitedata.SiteInfoDetail
import models.sitedata.joined.SiteInfoAll
//import models.sitedata... | tnddn/iv-web | portal/rest-portal/app/controllers/sitedata/modality/th/SiteInfoController.scala | Scala | apache-2.0 | 5,287 |
//package n_queens
import scala.math.abs
object nQueens {
case class Board(size: Int, occupied: List[Int])
def checkDiag(board: Board, pos: Int): Boolean = {
val new_row = board.occupied.length
def diagAttack(row: Int, col: Int): Boolean = {
if(abs(row - new_row) == abs(pos - col))
... | Bolt64/my_code | scala/n_queens.scala | Scala | mit | 1,301 |
package org.rz.fps.week2.lecture2
/**
* Currying exercise no 1.
*
* @author github.com/rozasdev
*/
object Exercise1 {
/**
* Performs the calculation of a function f for a given range of Integers (a to b).
*
* @param f The calculation function.
* @param op The operation between non base case ... | rozasdev/FPS | code/Week2/src/org/rz/fps/week2/lecture2/Exercise1.scala | Scala | apache-2.0 | 1,185 |
/***********************************************************************
* 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... | ccri/geomesa | geomesa-fs/geomesa-fs-storage/geomesa-fs-storage-orc/src/main/scala/org/locationtech/geomesa/fs/storage/orc/utils/OrcSearchArguments.scala | Scala | apache-2.0 | 6,224 |
/*
* Copyright 2015 the original author or 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 applicab... | arkadius/akka-simple | src/main/scala/akka/actor/simple/SimpleActor.scala | Scala | apache-2.0 | 3,194 |
/*
* Copyright (C) 2014 - 2019 Dennis Vriend <https://github.com/dnvriend>
* Copyright (C) 2019 - 2021 Lightbend Inc. <https://www.lightbend.com>
*/
package akka.persistence.jdbc
import akka.actor.ActorSystem
import akka.persistence.jdbc.config.{ JournalConfig, ReadJournalConfig, SlickConfiguration }
import akka.p... | dnvriend/akka-persistence-jdbc | core/src/test/scala/akka/persistence/jdbc/SingleActorSystemPerTestSpec.scala | Scala | apache-2.0 | 2,918 |
package ml.sparkling.graph.operators.measures.vertex.betweenness.flow.struct
import org.apache.spark.graphx.VertexId
/**
* Created by mth on 5/2/17.
*/
class CFBCNeighbourFlow(
val src: VertexId,
val dst: VertexId,
val sumOfPotential: Doub... | sparkling-graph/sparkling-graph | operators/src/main/scala/ml/sparkling/graph/operators/measures/vertex/betweenness/flow/struct/CFBCNeighbourFlow.scala | Scala | bsd-2-clause | 2,945 |
package name.abhijitsarkar.scala
import name.abhijitsarkar.scala.GitHubJsonProtocol._
import spray.json._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
/**
* @author Abhijit Sarkar
*/
/**
* Q7.6: Write a function that reports recent GitHub commits for a project.
* G... | abhijitsarkar/learning-scala | src/main/scala/name/abhijitsarkar/scala/GitHubClient.scala | Scala | gpl-3.0 | 1,497 |
package org.tejo.model
case class MarkdownValue(str: String) extends AnyVal
sealed trait KontribuEnskribo {
def text: MarkdownValue
def autoro: Persono
}
case class Kontribuo(text: MarkdownValue, autoro: Persono) extends KontribuEnskribo
case class MankoDeKontribuo(autoro: Persono) extends KontribuEnskribo {
o... | tomaszym/izabela | actor/src/main/scala/org/tejo/model/Kontribuo.scala | Scala | gpl-2.0 | 371 |
/*
* 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 ... | mkolod/incubator-spark | core/src/main/scala/org/apache/spark/deploy/master/MasterArguments.scala | Scala | apache-2.0 | 2,821 |
package ch18
object ex01 {
class Bug {
var pos = 0
var dir = +1
def move(d: Int) = { pos += d * dir; this }
def show() = { println(pos); this }
def turn() = { dir *= -1; this }
}
def main(args: Array[String]): Unit = {
val bugsy1 = new Bug()
bugsy1.move(4)
bugsy1.show
bugsy1.... | tuxdna/scala-for-the-impatient-exercises | src/main/scala/ch18/ex01.scala | Scala | apache-2.0 | 484 |
package org.yawni.wordnet
import javax.ws.rs._
import javax.ws.rs.core._
import javax.ws.rs.core.Response.Status._
import org.yawni.wordnet._
import org.yawni.util._
import org.yawni.wordnet.POS._
import org.yawni.wordnet.GlossAndExampleUtils._
import scala.xml._
import scala.collection.JavaConverters._
import java.u... | nezda/yawni | rest/src/main/scala/org/yawni/wordnet/Yawni.scala | Scala | apache-2.0 | 3,905 |
import org.scalatest.{Matchers, FunSpec}
/**
* Created by djdool on 7/10/15.
*/
class TemplateDoc_AT extends FunSpec with Matchers {
describe("com.monsanto.arch.cloudformation") {
// if this test fails, update it and the package documentation example
it("should verify that the template in the package docum... | joewing/cloudformation-template-generator | src/test/scala/com/monsanto/arch/cloudformation/model/TemplateDoc_AT.scala | Scala | bsd-3-clause | 4,673 |
/*
* 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.tools.nsc
packag... | scala/scala | src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala | Scala | apache-2.0 | 15,249 |
package play.api.cache.redis.impl
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.Specification
import play.api.cache.redis._
import scala.reflect.ClassTag
class RedisSortedSetSpec(implicit ee: ExecutionEnv) extends Specification with ReducedMockito {
import Implicits._
import RedisCacheImpli... | KarelCemus/play-redis | src/test/scala/play/api/cache/redis/impl/RedisSortedSetSpec.scala | Scala | mpl-2.0 | 3,495 |
/*
* Copyright 2015 Webtrends (http://www.webtrends.com)
*
* See the LICENCE.txt 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 compliance with the License.
* Yo... | Webtrends/wookiee-spray | src/main/scala/com/webtrends/harness/component/spray/serialization/EnumerationSerializer.scala | Scala | apache-2.0 | 1,657 |
/**
* 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... | ijuma/kafka | core/src/main/scala/kafka/server/AbstractFetcherThread.scala | Scala | apache-2.0 | 14,313 |
package drt.client.services.handlers
import diode.{ActionResult, ModelRW}
import drt.client.actions.Actions.{HideLoader, ShowLoader}
import drt.client.services.LoadingState
class LoaderHandler[M](modelRW: ModelRW[M, LoadingState]) extends LoggingActionHandler(modelRW) {
protected def handle: PartialFunction[Any, Ac... | UKHomeOffice/drt-scalajs-spa-exploration | client/src/main/scala/drt/client/services/handlers/LoaderHandler.scala | Scala | apache-2.0 | 476 |
package ch43_topology_sort
import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
class GraphTopology(vertex: Int) {
//define the graph
val adjacency = new Array[mutable.MutableList[Int]](vertex)
for (i <- Range(0, vertex)) {
adjacency(i) = new mutable.MutableList[Int]()
}
def add... | wangzheng0822/algo | scala/src/main/scala/ch43_topology_sort/GraphTopology.scala | Scala | apache-2.0 | 2,538 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | wangcy6/storm_app | frame/kafka-0.11.0/kafka-0.11.0.1-src/core/src/test/scala/unit/kafka/coordinator/transaction/TransactionLogTest.scala | Scala | apache-2.0 | 3,762 |
package com.lorandszakacs.util.time_wrappers
import java.{time => jt}
/**
*
* @author Lorand Szakacs, https://github.com/lorandszakacs
* @since 06 May 2018
*
*/
object LocalDateOrdering extends Ordering[jt.LocalDate] {
override def compare(x: jt.LocalDate, y: jt.LocalDate): Int = x.compareTo(y)
}
object ... | lorandszakacs/sg-downloader | util/src/main/scala/com/lorandszakacs/util/time_wrappers/timeOrderings.scala | Scala | apache-2.0 | 444 |
/**
* Generated by Scrooge
* version: ?
* rev: ?
* built at: ?
*/
package com.twitter.scrooge.test.gold.thriftscala
import com.twitter.io.Buf
import com.twitter.scrooge.{
InvalidFieldsException,
StructBuilder,
StructBuilderFactory,
TFieldBlob,
ThriftStruct,
ThriftStructField,
ThriftStructField... | twitter/scrooge | scrooge-generator-tests/src/test/resources/gold_file_output_scala/com/twitter/scrooge/test/gold/thriftscala/OverCapacityException.scala | Scala | apache-2.0 | 12,159 |
package org.jetbrains.plugins.scala.lang.completion3
import com.intellij.codeInsight.completion.CompletionType
import org.junit.Assert
import com.intellij.openapi.vfs.VfsUtil
import com.intellij.codeInsight.lookup.LookupElementPresentation
import org.jetbrains.plugins.scala.codeInsight.ScalaCodeInsightTestBase
/**
*... | consulo/consulo-scala | test/org/jetbrains/plugins/scala/lang/completion3/ScalaSmartCompletionTest.scala | Scala | apache-2.0 | 16,018 |
/*
* Copyright (c) 2011 Miles Sabin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | mandubian/shapeless | examples/src/main/scala/shapeless/examples/newtype.scala | Scala | apache-2.0 | 1,542 |
/*
* 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 ... | narahari92/spark | core/src/main/scala/org/apache/spark/deploy/DependencyUtils.scala | Scala | apache-2.0 | 5,066 |
package com.eevolution.context.dictionary.infrastructure.service.impl
import java.util.UUID
import com.eevolution.context.dictionary.infrastructure.repository.ViewRepository
import com.eevolution.context.dictionary.infrastructure.service.ViewService
import com.lightbend.lagom.scaladsl.api.ServiceCall
import com.light... | adempiere/ADReactiveSystem | dictionary-impl/src/main/scala/com/eevolution/context/dictionary/infrastructure/service/impl/ViewServiceImpl.scala | Scala | gpl-3.0 | 1,973 |
/*
* Copyright 2014 websudos ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | zarthross/reactiveneo | reactiveneo-dsl/src/main/scala/com/websudos/reactiveneo/client/JsonParser.scala | Scala | gpl-2.0 | 2,416 |
/**
* Copyright (c) 2016 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicabl... | ashaarunkumar/spark-tk | sparktk-core/src/test/scala/org/trustedanalytics/sparktk/graph/GraphSchemaTest.scala | Scala | apache-2.0 | 2,675 |
/*
* 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... | hibayesian/spark-fim | src/main/scala/org/apache/spark/mllib/fim/PPCTree.scala | Scala | apache-2.0 | 5,591 |
package com.signalcollect.dcop.evaluation
import scala.collection.concurrent.TrieMap
import scala.collection.immutable
import scala.collection.mutable
import scala.util.Random
import com.signalcollect.dcop.graph.DcopEdge
import com.signalcollect.dcop.graph.RankedDcopEdge
import com.signalcollect.dcop.graph.R... | flueckiger/dcop-algorithms-evaluation | src/main/scala/com/signalcollect/dcop/evaluation/Factories.scala | Scala | apache-2.0 | 12,927 |
/*
* Licensed to Metamarkets Group Inc. (Metamarkets) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Metamarkets licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); ... | druid-io/tranquility | core/src/test/scala/com/metamx/tranquility/test/common/JulUtils.scala | Scala | apache-2.0 | 1,041 |
package name.abhijitsarkar.scala
/**
* @author Abhijit Sarkar
*/
object Ch10 {
/**
* Q10.1: How would you extend a function? What are some of the applications for a class or trait
* that extends `Function1[A,B]`? If you are writing such a class or trait,
* would you extend `Function1[A,B]` or choose ... | abhijitsarkar/learning-scala | src/main/scala/name/abhijitsarkar/scala/Ch10.scala | Scala | gpl-3.0 | 3,141 |
import sbt._
import scala.util.Try
object Count {
private var count = 0
def get: Int = count
def increment(): Unit = count += 1
def reset(): Unit = count = 0
def reloadCount(file: File): Int = Try(IO.read(file).toInt).getOrElse(0)
}
| sbt/sbt | sbt-app/src/sbt-test/watch/on-start-watch/project/Count.scala | Scala | apache-2.0 | 244 |
package net.defoo
import java.io.File
/**
* Created by derek on 09/03/14.
*/
sealed case class CannotAccessBackupHomeException(backupHome: File)
extends Exception(s"Cannot access backupHome ${backupHome.getAbsolutePath}")
| kcderek/scala-time-machine | src/main/scala/net/defoo/BackupActorException.scala | Scala | apache-2.0 | 228 |
/*
* 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 ... | ashokblend/incubator-carbondata | examples/spark/src/main/scala/org/apache/carbondata/examples/AlluxioExample.scala | Scala | apache-2.0 | 2,434 |
import com.typesafe.sbt.pgp.PgpKeys._
import org.scalajs.sbtplugin.ScalaJSPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt.Keys._
import sbt._
object ScalajsReactComponents extends Build {
val Scala211 = "2.11.7"
val scalajsReactVersion = "0.9.2"
val scalaCSSVersion = "0.3.0"
type P... | tpdi/scalajs-react-components | project/Build.scala | Scala | apache-2.0 | 5,612 |
package com.sksamuel.elastic4s.requests.searches.aggs.builders
import com.sksamuel.elastic4s.handlers.searches.queries.QueryBuilderFn
import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory}
import com.sksamuel.elastic4s.requests.searches.aggs.{AggMetaDataFn, FiltersAggregation, SubAggsBuilderFn}
object ... | sksamuel/elastic4s | elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/aggs/builders/FiltersAggregationBuilder.scala | Scala | apache-2.0 | 789 |
package nest.sparkle.util
import java.nio.file.Paths
import java.io.BufferedInputStream
import java.io.BufferedReader
import java.io.InputStreamReader
import scala.io.Source
import java.util.jar.JarFile
import java.net.URLDecoder
import scala.collection.JavaConverters._
import java.io.File
import java.net.URL
import j... | mighdoll/sparkle | util/src/main/scala/nest/sparkle/util/Resources.scala | Scala | apache-2.0 | 3,022 |
/*
* Copyright 2011-2022 GatlingCorp (https://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... | gatling/gatling | gatling-charts/src/main/scala/io/gatling/charts/template/ResponsesPageTemplate.scala | Scala | apache-2.0 | 847 |
package com.aesireanempire.eplus
import com.aesireanempire.eplus.blocks.entities.TileEntityAdvEnchantmentTable
import com.aesireanempire.eplus.gui.elements.{DataProviderEnchantmentData, DataProviderInformation, ListItem, listItemEnchantments}
import com.aesireanempire.eplus.inventory.{SlotArmor, SlotEnchantment, Table... | darkhax/EnchantingPlus-Scala | src/main/scala/com/aesireanempire/eplus/ContainerAdvEnchantment.scala | Scala | lgpl-3.0 | 6,813 |
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this f... | transcendent-ai-labs/DynaML | dynaml-examples/src/main/scala/io/github/mandar2812/dynaml/examples/StanLinearModel.scala | Scala | apache-2.0 | 1,763 |
import common._
package object scalashop {
/** The value of every pixel is represented as a 32 bit integer. */
type RGBA = Int
/** Returns the red component. */
def red(c: RGBA): Int = (0xff000000 & c) >>> 24
/** Returns the green component. */
def green(c: RGBA): Int = (0x00ff0000 & c) >>> 16
/** R... | alicanalbayrak/ScalaExperiments | scalashop/src/main/scala/scalashop/package.scala | Scala | mit | 2,218 |
package http
package response
import scalaz._
import atto._, Atto._
object HttpResponseParser {
lazy val cr: Parser[Char] =
char(0x0D)
lazy val lf: Parser[Char] =
char(0x0A)
lazy val eol: Parser[Unit] =
(cr ~ lf | cr | lf) map (_ => ())
lazy val dot =
char('.')
lazy val zeroD: Parser[Op... | gpampara/scalaz-http-client | src/main/scala/http/response/HttpResponseParser.scala | Scala | bsd-3-clause | 1,899 |
package com.etsy.sahale
import org.apache.commons.httpclient.{HttpClient, HttpStatus}
import com.google.api.client.json.jackson2.JacksonFactory
import com.google.api.client.http.apache.ApacheHttpTransport
import org.apache.commons.httpclient.methods.{GetMethod, PostMethod}
import org.apache.commons.httpclient.NameValu... | etsy/Sahale | flowtracker-gcp/src/main/scala/GoogleAuthFlowTracker.scala | Scala | mit | 9,172 |
package kidstravel.client.components
import diode.data.Pot
import diode.react.ModelProxy
import diode.react.ReactPot._
import japgolly.scalajs.react.extra.router.RouterCtl
import japgolly.scalajs.react.vdom.prefix_<^._
import japgolly.scalajs.react.{BackendScope, ReactComponentB}
import kidstravel.client.KidsTravelMai... | devkat/kidstravel | client/src/main/scala/kidstravel/client/components/CityTile.scala | Scala | apache-2.0 | 1,647 |
import info.fotm.util.MathVector
object ComparerTestHelpers {
implicit val comparer = new org.scalactic.Equality[MathVector] {
override def areEqual(a: MathVector, b: Any): Boolean =
b.isInstanceOf[MathVector] && a.coords == b.asInstanceOf[MathVector].coords
}
implicit val seqComparer = new org.scala... | Groz/fotm-info | core/src/test/scala/ComparerTestHelpers.scala | Scala | mit | 572 |
//package org.sireum.pilarform.astselect
//
//import org.sireum.pilarform.lexer._
//import org.sireum.pilarform.util.Range
//import org.sireum.pilarform.util.Utils._
//import scala.util.control.Exception._
//import org.sireum.pilarform.PilarVersions
//
//object AstSelector {
//
// /**
// * Expands the given selectio... | fgwei/pilarform | pilarform/src/main/scala/org/sireum/pilarform/astselect/AstSelector.scala | Scala | epl-1.0 | 5,999 |
package ch.uzh.ifi.pdeboer.pplib.patterns
import ch.uzh.ifi.pdeboer.pplib.hcomp.{HCompPortalAdapter, MultipleChoiceAnswer, MultipleChoiceQuery}
import scala.concurrent.duration._
import scala.util.Random
/**
* Created by pdeboer on 24/10/14.
*/
class ContestExecutor[T](val driver: ContestDriver[T], val showsPerEle... | uzh/PPLib | src/main/scala/ch/uzh/ifi/pdeboer/pplib/patterns/Contest.scala | Scala | mit | 2,340 |
/*
* 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 ... | ArvinDevel/onlineAggregationOnSparkV2 | yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnSparkHadoopUtil.scala | Scala | apache-2.0 | 10,385 |
package documentation
import org.qirx.littlespec.Specification
object Test extends Specification {
"#Title" - {
"test" - {
1 + 1 is 2
}
"example" - {
example {
1 + 1 is 2
}
}
}
} | EECOLOR/little-spec | extra/documentation/src/sbt-test/test-dependencies/sbt-extra-documentation/testClasses/documentation/Test.scala | Scala | mit | 227 |
package org.pblue.asyncpools
class AsyncPoolsException(msg: String, cause: Throwable = null) extends Exception(msg, cause) | privateblue/asyncpools | src/main/scala/org/pblue/asyncpools/AsyncPoolsException.scala | Scala | mit | 123 |
package dotty.tools.dotc
package transform
import core._
import TreeTransforms._
import Contexts.Context
import Flags._
import SymUtils._
import Symbols._
import SymDenotations._
import Types._
import Decorators._
import DenotTransformers._
import StdNames._
import NameOps._
import Phases._
import ast.untpd
import ast... | yusuke2255/dotty | src/dotty/tools/dotc/transform/LinkScala2ImplClasses.scala | Scala | bsd-3-clause | 1,757 |
/*
* Copyright 2014 http4s.org
*
* 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... | http4s/blaze | core/src/main/scala/org/http4s/blaze/channel/nio1/FixedSelectorPool.scala | Scala | apache-2.0 | 1,455 |
package akka.persistence.hbase.snapshot
import akka.testkit.{ TestKit, TestProbe }
import akka.actor.{ ActorLogging, Props, ActorRef, ActorSystem }
import org.scalatest.{ BeforeAndAfterAll, FlatSpecLike }
import akka.persistence._
import akka.persistence.hbase.journal.{ HBaseClientFactory, HBaseJournalInit }
import or... | hossx/akka-persistence-hbase | src/test/scala/akka/persistence/hbase/snapshot/HadoopSnapshotStoreSpec.scala | Scala | apache-2.0 | 6,662 |
package com.truecar.mleap.runtime.transformer
import com.truecar.mleap.core.feature.StandardScaler
import com.truecar.mleap.runtime.attribute.AttributeSchema
import com.truecar.mleap.runtime.transformer.builder.TransformBuilder
import com.truecar.mleap.runtime.types.VectorType
import com.truecar.mleap.runtime.transfor... | TrueCar/mleap | mleap-runtime/src/main/scala/com/truecar/mleap/runtime/transformer/StandardScalerModel.scala | Scala | apache-2.0 | 991 |
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.