Skip to content

Instantly share code, notes, and snippets.

View danwerner's full-sized avatar

Daniel Werner danwerner

View GitHub Profile
@danwerner
danwerner / IntStub.scala
Last active February 19, 2021 14:10
How to use the Numeric/Integral typeclasses in Scala
package com.example.stubs
import scala.util.Random
object IntStub extends IntegralStub[Int] {
override def nextRandom(): Int = Random.nextInt()
override def nextRandom(upperBound: Int): Int = Random.nextInt(upperBound)
}
@danwerner
danwerner / pre-commit
Created June 3, 2011 15:24 — forked from jonasvp/pre-commit
My .git/hooks/pre-commit - save yourself from embarassment using pyflakes
#!/bin/bash
# Original version (C) 2011 by jonasvp
# Modified version by danwerner
# Save this file as .git/hooks/pre-commit, make it executable, and it will
# thank you by saving you from common mistakes *before* deployment.
# Conflict markers
git diff --cached --diff-filter=ACMR | awk '/\+(<<<[<]<<<|>>>[>]>>>|===[=]===$)/ { exit 1 }'
CODE=$?