Skip to content

Instantly share code, notes, and snippets.

Miles Sabin milessabin

Block or report user

Report or block milessabin

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
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

bishboria /
Last active Oct 17, 2019
Springer made a bunch of books available for free, these were the direct links
almost /
Last active Sep 12, 2019
Reactive 2016 Lightning Talk Proposal: Get Flow

This is a proposal for a lightning talk at the Reactive 2016 conference.

NOTE: If you like this, star ⭐️ the Gist - the amount of stars decides whether it makes the cut! You could also Retweet if you want :)

Get Flow

Type checking JavaScript with Flow

JavaScript is a dynamic language, and there's nothing wrong with that. It allows quick iteration and lowers barriers. However, sometimes some compile-time type checking is just what you need to keep your code in line and give yourself the confidence to build bigger and faster. Flow gives the best of both worlds. You can have normal JavaScript but you can also add types where they're helpful, and it adds zero cost at runtime. In this talk I'll show Flow as it applies to a Redux & React codebase.

copumpkin / Prime.agda
Last active Sep 9, 2019
There are infinite primes
View Prime.agda
module Prime where
open import Coinduction
open import Data.Empty
open import Data.Nat
open import Data.Nat.Properties
open import Data.Nat.Divisibility
open import Data.Fin hiding (pred; _+_; _<_; _≤_; compare)
open import Data.Fin.Props hiding (_≟_)
retronym / type-bounds.scala
Created Dec 16, 2009
Tour of Scala Type Bounds
View type-bounds.scala
class A
class A2 extends A
class B
trait M[X]
// Upper Type Bound
def upperTypeBound[AA <: A](x: AA): A = x
retronym / lub2.scala
Created Mar 23, 2010
Calculate the Least Upper Bound of two types.
View lub2.scala
object test {
case class L[A, B]() {
def ToLub[AA >: A <: L, BB >: B <: L, L] = new { type LUB = L }
val intBoolLub = L[Int, Boolean].ToLub
(1: AnyVal) : intBoolLub.LUB
1: intBoolLub.LUB
travisbrown / fizzbuzz-faster.scala
Created Nov 18, 2012
FizzBuzz in the type system (faster)
View fizzbuzz-faster.scala
import shapeless._, Nat._
trait FizzBuzz[N <: Nat] {
type R3 <: Nat
type R5 <: Nat
def ti: ToInt[N]
def prev: List[String]
def d3: R3 =:= _0
def d5: R5 =:= _0
non /
Last active Feb 2, 2019
I feel like conversations around laws and lawfulness in Scala are often not productive, due to a lack of rigor involved. I wanted to try to be as clear and specific as possible about my views of lawful (and unlawful) behavior, and what I consider a correct and rigorous way to think about laws (and their limits) in Scala.


A law is a group of two or more expressions which are required to be the same. The expressions will usually involve one or more typed holes ("inputs") which vary.

Some examples:                 === x
kmizu / TypeConstructorCurrying.scala
Created Sep 25, 2011
Scala's type constructor is not "curried" form. In this example, it is explained that we can emulate type constructor currying using abstract type member.
View TypeConstructorCurrying.scala
trait TF {
type Apply[A]
type Curry2[F[_, _]] = TF { type Apply[X] = TF { type Apply[Y] = F[X, Y] } }
type Curry3[F[_, _, _]] = TF { type Apply[X] = Curry2[(TF { type Apply[Y, Z] = F[X, Y, Z] })#Apply] }
// ...
type CurriedMap = Curry2[Map]
val x: CMap#Apply[String]#Apply[Int] = Map("x" -> 1, "y" -> 1) //It is valid code.
travisbrown / tower-of-hanoi.scala
Created Sep 23, 2012
Solving the Tower of Hanoi at the type level
View tower-of-hanoi.scala
* Type-level Tower of Hanoi
* by Travis Brown
* Note: not optimal, and probably won't work for some valid inputs.
* Tested with Scala 2.9.2 and Shapeless 1.2.3.
import shapeless._, Nat._
You can’t perform that action at this time.