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
View Typeclass.scala
//In library
trait Event
trait EventCombiner[A <: Event] {
def initialValue: Int
def combineEvents(value: Int, e2: A): Int
def foldEvents[A <: Event](list: Seq[A])(implicit C: EventCombiner[A]): Int =

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
abdheshkumar / fpmax.scala
Created Jul 13, 2018 — forked from jdegoes/fpmax.scala
FP to the Max — Code Examples
View fpmax.scala
package fpmax
import scala.util.Try
object App0 {
def main: Unit = {
println("What is your name?")
val name = readLine()
DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.
CREATE – to create database and its objects like (table, index, views, store procedure, function and triggers)
ALTER – alters the structure of the existing database
DROP – delete objects from the database
TRUNCATE – remove all records from a table, including all spaces allocated for the records are removed
COMMENT – add comments to the data dictionary
RENAME – rename an object
abdheshkumar / Conversions.scala
Created Apr 11, 2018 — forked from SystemFw/Conversions.scala
Typed schema conversion with shapeless
View Conversions.scala
object Conversions {
import cats._, implicits._, data.ValidatedNel
import mouse._, string._, option._
import shapeless._, labelled._
private type Result[A] = ValidatedNel[ParseFailure, A]
case class ParseFailure(error: String)
trait Convert[V] {
View scala-exception-handling.scala
val tryCatch = try {
//Code here that might raise an exception
throw new Exception
} catch {
case ex: Exception =>
//Code here for handle an exception
val tryMultipleCatch = try {
//Code here that might raise an exception
View generic-type-pattern.scala
sealed trait A
case class B[Req, Res](r: Req, rs: Res) extends A
case class C[Req](r: Req, errorCode: Int, errorMessage: String) extends A
trait TypeA[Req, Res] {
def success(t: Req, r: Res): Unit
def error(t: Req): Unit
implicit val forString = new TypeA[String, String] {
override def success(t: String, r: String): Unit = ???
View Contravariance.scala
trait Item
trait PlasticItem extends Item
trait PlasticBottle extends PlasticItem
trait PaperItem extends Item
trait NewsPaper extends PaperItem
View Object-Function.js
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<script src=""></script>
<script type="text/javascript">
Office = {
initialize: function (reason) {
View options.js
type: 'devs.Model',
inPorts: [],
outPorts: [],
size: {
width: 80,
height: 80
attrs: {
You can’t perform that action at this time.