Skip to content

Instantly share code, notes, and snippets.

View wojtekerbetowski's full-sized avatar

Wojtek Erbetowski wojtekerbetowski

View GitHub Profile
class UserRegistrator with Hashing {
def register(username, password) = User(username, password.hash).save
}
trait Hashing {
@Inject private val hasher: Hasher = null
implicit def stringToHashable(toBeHashed: String) = new {
def hash = hasher.hash(toBeHashed)
}
}
@wojtekerbetowski
wojtekerbetowski / file1.scala
Created February 18, 2012 20:27
simple implicit
implicit def stringToHashable(toBeHashed: String) = new {
def hash = hasher.hash(toBeHashed)
}
@wojtekerbetowski
wojtekerbetowski / gist:1860906
Created February 18, 2012 20:16
Implicit method add
implicit def stringToHashable(toBeHashed: String) = new {
def hash = // hashing logic
}