Skip to content

Instantly share code, notes, and snippets.

Sherif Mohamed sherifkandeel

  • Berlin, Germany
Block or report user

Report or block sherifkandeel

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
sherifkandeel / reductionCompare.scala
Created Oct 28, 2019
Comparing different ways to get minimum of a collection
View reductionCompare.scala
case class TestCaseClass(cost: Float, other1: Int, other2: String, other3: String)
val r = new scala.util.Random(31)
val tenkList = 1 to 10000 map (_ => TestCaseClass(r.nextFloat(), r.nextInt, r.alphanumeric.take(3).mkString, ""))
val millionList = 1 to 1000000 map (_ => TestCaseClass(r.nextFloat(), r.nextInt, r.alphanumeric.take(3).mkString, ""))
val tenMillionList = 1 to 10000000 map (_ => TestCaseClass(r.nextFloat(), r.nextInt, r.alphanumeric.take(3).mkString, ""))
def time[R](block: => R): Long = {
val t0 = System.currentTimeMillis()
val t1 = System.currentTimeMillis()
sherifkandeel / MapCompare.scala
Created May 10, 2019
Comparing different Scala Map performance
View MapCompare.scala
import scala.collection.concurrent
import scala.collection.immutable._
val concurrentTrieMap: concurrent.Map[String, String] = concurrent.TrieMap.empty
var immutableMap: Map[String, String] = Map.empty
var hashMap: HashMap[String, String] = HashMap.empty
def time[R](block: => R): String = {
val t0 = System.nanoTime()
View Scala-std
- Abstract class vs trait
- how does traits prevent the diamond problem
- Algebraic data types over options
- Cake pattern, why you shouldn't use it
- extends product with serializable
- case object, case class vs object, class
- value classes
- type classes
- Monads of the standard library
- Option
sherifkandeel /
Created Sep 9, 2016 — forked from MicahElliott/
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
You can’t perform that action at this time.