Skip to content

Instantly share code, notes, and snippets.

View knutwalker's full-sized avatar
🦀
I may be slow to respond.

Paul Horn knutwalker

🦀
I may be slow to respond.
View GitHub Profile
@propensive
propensive / alloc.scala
Created March 21, 2015 22:34
`alloc`, an alternative to `new`, with better syntax and type inference
Welcome to Scala version 2.10.5 (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import rapture.core._
import rapture.core._
scala> val str: String = alloc() // new String()
str: String = ""
@propensive
propensive / outcomes.scala
Last active August 29, 2015 14:15
Using TMaps for error handling
Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
// Import the Rapture modules we need
scala> import rapture._, uri._, codec._, io._, fs._, core._, csv._
import rapture._
import uri._
import codec._
import io._
@propensive
propensive / heteroargs.scala
Created January 31, 2015 20:03
Easy Heterogeneous Varargs in Scala
// Define the general Arg type and companion object:
import language.higherKinds, language.implicitConversions, language.existentials
object Arg { implicit def toArg[Tc[_], T: Tc](t: T): Arg[T, Tc] = Arg(t, implicitly[Tc[T]]) }
case class Arg[T, Tc[_]](value: T, typeclass: Tc[T])
// Say, for example we have a typeclass for getting the length of something, with a few instances
trait Lengthable[T] { def length(t: T): Int }
implicit val intLength = new Lengthable[Int] { def length(i: Int) = 1 }
implicit val stringLength = new Lengthable[String] { def length(s: String) = s.length }
@jnauber
jnauber / dockercon2014
Created December 9, 2014 18:31
What's up in Dockerland
What's Up in Dockerland?
dockercon Europe 2014
Ankündigungen
- Docker
- Docker Machine
- "Machine makes it really easy to create Docker hosts on local hypervisors and cloud providers. It creates servers, installs Docker on them, then configures the Docker client to talk to them."
- Kapselt unterschiedliche "Driver" und bietet ein einheitliches Interface um die Docker-Ready Maschinen zu deployen
package com.rr.experiment
import org.specs2.ScalaCheck
import org.specs2.mutable._
import org.scalacheck._
import scalaz._
import scodec._
@staltz
staltz / introrx.md
Last active July 13, 2025 10:33
The introduction to Reactive Programming you've been missing
@kevinwright
kevinwright / scaladays2014.md
Last active November 16, 2024 17:40
Scaladays 2014 slides

As compiled by Kevin Wright a.k.a @thecoda

(executive producer of the movie, and I didn't even know it... clever huh?)

please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!

This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!

Monday June 16th

@headinthebox
headinthebox / gist:37c76829253388fd88e3
Last active August 29, 2015 14:02
Fun with Functional Programming

Exercise: Define foldl in terms of foldr

Recall the definition of folding a list from the right

    foldr :: (a -> b -> b) -> b -> [a] -> b
    foldr f b []     = b
    foldr f b (a:as) = f a (foldr f b as)

for example foldr f b [1,2,3] = f 1 (f 2 (f 3 b)).

@runarorama
runarorama / gist:a8fab38e473fafa0921d
Last active April 13, 2021 22:28
Compositional application architecture with reasonably priced monads
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]
@viktorklang
viktorklang / in-fino-veritas.zsh-theme
Last active July 31, 2023 01:47
In Fino Veritas ZSH theme
#!/usr/bin/env zsh
# in fino veritas
# Borrowing shamelessly from these oh-my-zsh themes:
# fino-time
# pure
# https://gist.github.com/smileart/3750104
# Set required options