Skip to content

Instantly share code, notes, and snippets.

Avatar

Mariusz Nosiński marioosh

View GitHub Profile
@marioosh
marioosh / ChatRoom.scala
Last active Mar 1, 2020
websocket based on akka-http
View ChatRoom.scala
class ChatRoom(roomId: Int, actorSystem: ActorSystem) {
private[this] val chatRoomActor = actorSystem.actorOf(Props(classOf[ChatRoomActor], roomId))
def websocketFlow(user: String): Flow[Message, Message, _] = ???
def sendMessage(message: ChatMessage): Unit = chatRoomActor ! message
}
@marioosh
marioosh / DAO.scala
Created Jun 26, 2018
HowToGraphql - Sangria tutorial - Mutations
View DAO.scala
package com.howtographql.scala.sangria
import DBSchema._
import com.howtographql.scala.sangria.models.{AuthProviderSignupData, Link, User, Vote}
import sangria.execution.deferred.{RelationIds, SimpleRelation}
import slick.jdbc.H2Profile.api._
import scala.concurrent.Future
class DAO(db: Database) {
def allLinks = db.run(Links.result)
@marioosh
marioosh / DAO.scala
Created Jun 26, 2018
HowToGraphql - Sangria tutorial - Relations - finish
View DAO.scala
package com.howtographql.scala.sangria
import DBSchema._
import com.howtographql.scala.sangria.models.{Link, User, Vote}
import sangria.execution.deferred.{RelationIds, SimpleRelation}
import slick.jdbc.H2Profile.api._
import scala.concurrent.Future
class DAO(db: Database) {
def allLinks = db.run(Links.result)
@marioosh
marioosh / Server.scala
Created May 20, 2016
Basic akka-http server
View Server.scala
package io.scalac.conductr.example
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Sink, Source}
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
@marioosh
marioosh / DAO.scala
Created Jun 26, 2018
HowToGraphql - Sangria tutorial - Interfaces
View DAO.scala
package com.howtographql.scala.sangria\
import DBSchema._
import com.howtographql.scala.sangria.models.{Link, User, Vote}
import slick.jdbc.H2Profile.api._
import scala.concurrent.Future
class DAO(db: Database) {
def allLinks = db.run(Links.result)
@marioosh
marioosh / AuthMiddleware.scala
Created Jun 26, 2018
HowToGraphql - Sangria tutorial - Authentication
View AuthMiddleware.scala
package com.howtographql.scala.sangria
import com.howtographql.scala.sangria.models.Authorized
import sangria.execution.{Middleware, MiddlewareBeforeField, MiddlewareQueryContext}
import sangria.schema.Context
object AuthMiddleware extends Middleware[MyContext] with MiddlewareBeforeField[MyContext] {
override type QueryVal = Unit
override type FieldVal = Unit
@marioosh
marioosh / DBSchema.scala
Created Jun 26, 2018
HowToGraphql - Sangria tutorial - Relations
View DBSchema.scala
package com.howtographql.scala.sangria
import java.sql.Timestamp
import akka.http.scaladsl.model.DateTime
import com.howtographql.scala.sangria.models._
import slick.jdbc.H2Profile.api._
import scala.concurrent.duration._
import scala.concurrent.Await
View Hunter Heavy
< 6 7 0 > - H: HunterHeavy-1.2.0 A: HunterHeavy-2.1.0 C: HunterHeavy-1.3.0 L: HunterHeavy-2.1.0
< 6 6 1 > - H: HunterHeavy-1.2.0 A: HunterHeavy-2.1.0 C: HunterHeavy-1.2.1 L: HunterHeavy-2.1.0
< 6 6 1 > - H: HunterHeavy-1.1.1 A: HunterHeavy-2.1.0 C: HunterHeavy-1.3.0 L: HunterHeavy-2.1.0
< 6 5 2 > - H: HunterHeavy-1.1.1 A: HunterHeavy-2.1.0 C: HunterHeavy-1.2.1 L: HunterHeavy-2.1.0
< 5 8 0 > - H: HunterHeavy-1.2.0 A: HunterHeavy-2.1.0 C: HunterHeavy-1.3.0 L: HunterHeavy-1.2.0
< 5 8 0 > - H: HunterHeavy-1.2.0 A: HunterHeavy-1.2.0 C: HunterHeavy-1.3.0 L: HunterHeavy-2.1.0
< 5 7 1 > - H: HunterHeavy-1.2.0 A: HunterHeavy-2.1.0 C: HunterHeavy-1.2.1 L: HunterHeavy-1.2.0
< 5 7 1 > - H: HunterHeavy-1.2.0 A: HunterHeavy-1.2.0 C: HunterHeavy-1.2.1 L: HunterHeavy-2.1.0
< 5 7 1 > - H: HunterHeavy-1.1.1 A: HunterHeavy-2.1.0 C: HunterHeavy-1.3.0 L: HunterHeavy-1.2.0
< 5 7 1 > - H: HunterHeavy-1.1.1 A: HunterHeavy-1.2.0 C: HunterHeavy-1.3.0 L: HunterHeavy-2.1.0
@marioosh
marioosh / devise.pl.yml
Created Mar 28, 2011
Devise polish translation, for version 1.2 and up
View devise.pl.yml
# Works with devise 1.2 rails 3 (rails 2 not tested)
pl:
errors:
messages:
not_found: "nie znaleziono"
already_confirmed: "już został aktywowany"
not_locked: "nie był zablokowany"
not_saved:
one: "%{resource} nie został zapisany z powodu jednego błędu:"
View SudokuSolver.java
package sudoku;
import solver.Solver;
import solver.constraints.IntConstraintFactory;
import solver.search.strategy.IntStrategyFactory;
import solver.variables.IntVar;
import solver.variables.VariableFactory;
import util.tools.ArrayUtils;
/**
You can’t perform that action at this time.