Skip to content

Instantly share code, notes, and snippets.

View stsatlantis's full-sized avatar

Barnabás Oláh stsatlantis

View GitHub Profile
@soujiro32167
soujiro32167 / DocUtils.scala
Created May 7, 2020 14:29
Extracting a static redoc site from Tapir
import java.nio.file.{ Files, Path, Paths }
import cats.effect.{ ContextShift, IO }
import org.http4s.{ HttpRoutes, Request }
import sttp.tapir.Endpoint
import sttp.tapir.redoc.http4s.RedocHttp4s
import sttp.tapir.openapi.circe.yaml._
import sttp.tapir.docs.openapi._
object DocUtils {
@rdump
rdump / kubectl-multi-version-brews.md
Last active April 4, 2024 15:20
kubectl multi-version brews (kubernetes-cli formula)

kubectl multi-version brews

Applicability

The instructions below apply to older versions of Homebrew which still provide switch capability.

For current Homebrew, you'll likely need to keep Versions around, and build locally. Here's my versions repository https://github.com/rdump/homebrew-versions

MacPorts is now keeping versioned installations available as well, by default.

[
{
"map":{
"round_wins":{
"1":"ct_win_elimination",
"2":"ct_win_elimination",
"3":"t_win_elimination",
"4":"t_win_elimination",
"5":"ct_win_defuse",
"6":"ct_win_elimination",

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
@jpallari
jpallari / Main.scala
Last active February 5, 2024 08:29
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)"
}
@wcharczuk
wcharczuk / sudoku-solved.txt
Created August 31, 2015 18:02
Solved sudoku board
7 4 3 9 5 1 6 8 2
1 6 2 4 8 7 3 9 5
9 5 8 6 3 2 7 1 4
2 1 9 8 7 3 5 4 6
3 7 4 5 6 9 1 2 8
5 8 6 1 2 4 9 7 3
4 9 5 2 1 6 8 3 7
8 2 7 3 9 5 4 6 1
6 3 1 7 4 8 2 5 9

EDIT: This gist has been promoted and is now a blog post.

Kinda-Curried Type Parameters

Scala methods can have multiple lists of value parameters but only one list of type parameters, which is occasionally irritating when some are inferable and others are not. Consider this method which has two type parameters, one inferable and one not.

import scalaz._, Scalaz._
@owainlewis
owainlewis / .gitignore
Created June 27, 2014 07:36
Scala gitignore
*.class
*.log
# sbt specific
.cache/
.history/
.lib/
dist/*
target/
lib_managed/
@lshoo
lshoo / gist:9785645
Created March 26, 2014 15:13
Slick2 generic dao
package slicks.docs.dao
import scala.slick.driver.PostgresDriver.simple._
import scala.slick.driver._
trait Profile {
val profile: JdbcProfile
}