This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz._ | |
trait ScalazLight | |
extends std.AllInstances | |
with syntax.std.ToOptionIdOps | |
with syntax.std.ToOptionOps | |
with syntax.ToEqualOps | |
with syntax.ToIdOps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val primes: Stream[Int] = 2 #:: Stream.from(3).filter { n => !primes.takeWhile(_ <= math.sqrt(n)).exists(n % _ == 0) } | |
def isPrime(n: Int) = primes.dropWhile(_ < n).head == n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent.duration._ | |
import scala.concurrent.ExecutionContext | |
import scala.concurrent.Future | |
import akka.pattern.after | |
import akka.actor.Scheduler | |
/** | |
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown, | |
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through | |
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure. |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File | |
/** | |
* A completely OS-Agnostic way of dealing with java.io.File paths | |
*/ | |
object RichPath { | |
sealed class RichBase[+A](left: A) { | |
/** | |
* Simple enrichment method designed to let you create a java.io.File | |
* by simply writing "folderA" / "folderB" / "folderC" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.iainhull.akka | |
import scala.concurrent.duration._ | |
import akka.actor._ | |
import akka.event.Logging | |
import akka.pattern.ask | |
import akka.util.Timeout | |
import akka.persistence.{PersistentView, AtLeastOnceDelivery, PersistentActor} |
This script scans your Dropbox (or any given folder) for folders stored in the ignore
array and excludes them from syncing. Makes use of the official Dropbox CLI
I'm a beginner at bash, so all improvements are welcome!
#!/bin/bash
set -e
# SETTINGS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PROBLEM STATEMENT | |
// Let's build Proxy[T], an object that can capture calls to methods of an underlying object. | |
// We want the proxy to be type-safe, i.e. we need to verify that the names of the calls | |
// and the arguments that are passed to those calls are well-typed wrt the type of the proxee. | |
object Test extends App { | |
trait Foo { /* ... */ } | |
val proxy: Proxy[Foo] = ??? | |
proxy.bar() |