Skip to content

Instantly share code, notes, and snippets.

Abdhesh Kumar abdheshkumar

Block or report user

Report or block abdheshkumar

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
@abdheshkumar
abdheshkumar / digest.scala
Created Sep 8, 2017
Akka stream flow fold
View digest.scala
import java.nio.ByteBuffer
import java.security.MessageDigest
import javax.xml.bind.DatatypeConverter
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpMethods.GET
import akka.http.scaladsl.model.{HttpRequest, HttpResponse}
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Flow, Keep, Sink}
View report_properties.json
```javascript
{
"title":"Report Properties",
"description":"A JSON Schema describing a Report Properties",
"$schema":"http://json-schema.org/draft-04/schema#",
"type":"object",
"properties":{
"server":{
"type":"string",
"description":"URL of JRS instance."
@abdheshkumar
abdheshkumar / facades.scala
Last active Aug 22, 2017
ScalaJs facades
View facades.scala
@js.native
trait Auth extends js.Object {
val byToken: js.UndefOr[LoginWithSSOToken] = js.undefined
val byCredentials: js.UndefOr[LoginWithPlainText] = js.undefined
}
object Auth {
def apply(authType: AuthType): Auth = authType match {
case byToken: LoginWithSSOToken => js.Dynamic.literal(byToken = byToken).asInstanceOf[Auth]
case byCredentials: LoginWithPlainText => js.Dynamic.literal(byCredentials = byCredentials).asInstanceOf[Auth]
View function-translation.scala
val fun: ((Int, Int)) => Int = (kv: Tuple2[Int, Int]) => kv match {
case (k, v) => k + v
}
val fun1: Function1[Tuple2[Int, Int], Int] = (kv: Tuple2[Int, Int]) => kv match {
case (k, v) => k + v
}
val myMap = Map(1 -> 2, 2 -> 3)
myMap.map(fun)
@abdheshkumar
abdheshkumar / Typeclasses.scala
Created Aug 10, 2017
How to implement typeclasses
View Typeclasses.scala
trait Named[E] {
val name: String
}
case class EOL()
implicit val namedInt = new Named[Int] {
override val name: String = "Int"
}
View sealed-protected.scala
** Working */
sealed class AB[+A] protected(protected val in: List[A], protected val out: List[A])
object AB {
class ABC(override protected val in: List[Int],
override protected val out: List[Int])
extends AB(in, out)
}
/**Not Working*/
sealed class AB[+A] protected(protected val in: List[A], protected val out: List[A])
View text.log
Command:
connect\n\n
Response:
Event-Name: CHANNEL_DATA
Core-UUID: d01fd5af-47d1-4cc0-9135-72be72656b21
FreeSWITCH-Hostname: abdhesh-System-Product-Name
FreeSWITCH-Switchname: abdhesh-System-Product-Name
FreeSWITCH-IPv4: 10.0.0.29
FreeSWITCH-IPv6: %3A%3A1
@abdheshkumar
abdheshkumar / README.md
Created Jul 9, 2017 — forked from pathikrit/README.md
My highly opinionated list of things needed to build an app in Scala
View README.md
View TraverseFreestyle.scala
import cats.Id
import cats.implicits._
import freestyle._
import freestyle.implicits._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
/**
* Created by abdhesh on 05/05/17.
View combine-interpreters.scala
import freestyle._
import freestyle.implicits._
import freestyle.implicits.interpretAp
import cats.implicits._
case class ValidationResult(isValid:Boolean, events:List[Event])
trait Command
case class UnknownCommand(cmd:Any) extends Command
sealed trait Event {val name:String}
You can’t perform that action at this time.