This file contains 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
for cid in $(git branch -av | grep -v "> origin" | awk '{print $2}'); do; git show --pretty="%ct@%cn@%s" $cid | head -1; done | sort | gawk -F "@" '{print strftime("%c", $1) " : " $2 " : " $3}' |
This file contains 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
gulp = require('gulp') | |
coffee = require('gulp-coffee') | |
stylus = require('gulp-stylus') | |
nib = require('nib') | |
livereload = require('gulp-livereload') | |
wait = require('gulp-wait') | |
paths = | |
coffee: | |
in : ['js/**/*'] |
This file contains 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
gulp = require('gulp') | |
fileinclude = require('gulp-file-include') | |
coffee = require('gulp-coffee') | |
runSequence = require('run-sequence') | |
app = 'app' | |
paths = | |
fileinclude: | |
in : ["#{app}/**/*.coffee", "!#{app}/.tmp"] |
This file contains 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
def interval2seq(in: Interval): Seq[DateTime] = { | |
@tailrec | |
def f(t: DateTime, acum: Seq[DateTime]): Seq[DateTime] = if (in.contains(t)) f(d.plusDay(1), t +: acum) else acum.reverse | |
f(in.start, Nil) | |
} |
This file contains 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
"foo" -> mapping( | |
"msg" -> text.transform[String](toLF, identity) | |
)(Foo.apply)(Foo.unapply) | |
def toLF(a: String): String = a.replaceAll("(\r\n|\r)","\n") |
This file contains 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
trait Foo[T] { | |
def bar(list: Seq[T]): Unit | |
} | |
object Foo { | |
def bar[T: Foo](list: Seq[T]): Unit = implicitly[Foo[T]].bar(list) | |
implicit val FooInt = new Foo[Int] { | |
def bar(list: Seq[Int]): Unit = println("Int " + list) | |
} | |
implicit val FooDouble = new Foo[Double] { |
This file contains 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
scala> def sleep = { Thread.sleep(2000); println("done"); 1 } | |
sleep: Int | |
scala> for { a <- Future(sleep); b <- Future(sleep) } yield { println(a + b) } | |
res19: scala.concurrent.Future[Unit] = scala.concurrent.impl.Promise$DefaultPromise@52621501 | |
scala> done | |
done | |
2 |
This file contains 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
scala> class Person | |
defined class Person | |
scala> class Bob extends Person | |
defined class Bob | |
scala> class Alice extends Person | |
defined class Alice | |
scala> class School[+A] |
This file contains 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
case class Base(n: BigDecimal) { | |
def toMicro: Micro = Micro(n * 1000000) | |
} | |
case class Micro(n: BigDecimal) { | |
def toBase: Base = Base(n / 1000000) | |
} | |
sealed abstract class Converter[From, To] extends (From => To) | |
object Converter { | |
def apply[A, B](a: A)(implicit c: Converter[A, B]): B = c(a) |
This file contains 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
scala> def fid[F[_], A](a: F[A]): F[A] = a | |
warning: there was one feature warning; re-run with -feature for details | |
fid: [F[_], A](a: F[A])F[A] | |
scala> fid(List(1)) | |
res0: List[Int] = List(1) | |
scala> fid(Option(1)) | |
res1: Option[Int] = Some(1) |
OlderNewer