Skip to content

Instantly share code, notes, and snippets.

Oleg Skovpen oskoi

Block or report user

Report or block oskoi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View slick-example.scala
object Main extends App {
val category = TableQuery[Category]
val db = Database.forURL("jdbc:mysql://192.168.99.100:3306/db1", driver="com.mysql.jdbc.Driver", user="user1", password="")
val setup = DBIO.seq(
category += (1, "ELECTRONICS", None),
category += (2, "TELEVISIONS", Some(1)),
category += (3, "TUBE", Some(2)),
category += (4, "LCD", Some(2)),
category += (5, "PLASMA", Some(2)),
@oskoi
oskoi / simple-akka-streams.scala
Created Nov 14, 2015
Realisation simple akka-streams with broadcast.
View simple-akka-streams.scala
import akka.actor.ActorSystem
import akka.stream.{ClosedShape, ActorMaterializer}
import akka.stream.scaladsl._
import akka.stream.io.Implicits._
import akka.util.ByteString
import java.io.File
/**
* Created by oskovpen on 15/11/2015.
*/
@oskoi
oskoi / n-queen.scala
Last active Nov 13, 2015
Solution to n-queen problem on Scala. PS. From book Scala by Example, Martin Odersky, 2014
View n-queen.scala
def queens(n: Int): List[List[Int]] = {
def placeQueens(k: Int): List[List[Int]] =
if (k == 0) List(List())
else for { queens <- placeQueens(k - 1)
column <- List.range(1, n + 1)
if isSafe(column, queens, 1) } yield column :: queens
placeQueens(n)
}
def isSafe(col: Int, queens: List[Int], delta: Int): Boolean =
You can’t perform that action at this time.