Skip to content

Instantly share code, notes, and snippets.

View lure's full-sized avatar

Alex Shubert lure

  • JetBrains, LLC
View GitHub Profile

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@lure
lure / Main.scala
Created May 24, 2020 03:38 — forked from jpallari/Main.scala
Ways to pattern match generic types in Scala
object Main extends App {
AvoidLosingGenericType.run()
AvoidMatchingOnGenericTypeParams.run()
TypeableExample.run()
TypeTagExample.run()
}
class Funky[A, B](val foo: A, val bar: B) {
override def toString: String = s"Funky($foo, $bar)"
}
@lure
lure / compileGwt.groovy
Created September 7, 2019 19:56 — forked from marcokrikke/compileGwt.groovy
compileGwt Gradle task
task compileGwt (dependsOn: classes, type: JavaExec) {
buildDir = "${project.buildDir}/gwt"
extraDir = "${project.buildDir}/extra"
inputs.source sourceSets.main.java.srcDirs
inputs.dir sourceSets.main.output.resourcesDir
outputs.dir buildDir
// Workaround for incremental build (GRADLE-1483)
outputs.upToDateSpec = new org.gradle.api.specs.AndSpec()
@lure
lure / fpmax.scala
Created May 17, 2019 17:28 — forked from jdegoes/fpmax.scala
FP to the Max — Code Examples
package fpmax
import scala.util.Try
import scala.io.StdIn.readLine
object App0 {
def main: Unit = {
println("What is your name?")
val name = readLine()
@lure
lure / postgresql_pg_stat_activity_with_tempfiles.sql
Created September 4, 2018 19:47 — forked from ng-pe/postgresql_pg_stat_activity_with_tempfiles.sql
postgresql "pg_stat_activity" with temporary files information
-- View pg_stat_activity with temporary files informations (file list and total file size)
-- version 0.3
SELECT
pg_stat_activity.pid AS pid,
CASE WHEN LENGTH(pg_stat_activity.datname) > 16
THEN SUBSTRING(pg_stat_activity.datname FROM 0 FOR 6)||'...'||SUBSTRING(pg_stat_activity.datname FROM '........$')
ELSE pg_stat_activity.datname
END
AS database,

Advanced Functional Programming with Scala - Notes

Copyright © 2017 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
@lure
lure / docker-log-gist.md
Created January 13, 2017 09:58 — forked from afolarin/docker-log-gist.md
docker-logs