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
var steps = document.getElementsByClassName("step"); | |
var r = 2000; | |
for (var i = 0; i < steps.length; i++) { | |
var theta = -i/(steps.length-1) * 2 * Math.PI; | |
var x = r * Math.cos(theta); | |
var y = r * Math.sin(theta); | |
var rotation = theta/(2*Math.PI) * 360 - 90; | |
steps[i].setAttribute("data-x", Math.round(x).toString()); |
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
package com.gu.hadoop | |
import org.apache.hadoop.util.GenericOptionsParser | |
object ApplicationParameters { | |
def apply(args: Array[String]): List[String] = { | |
new GenericOptionsParser(args).getRemainingArgs.toList | |
} | |
} |
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
name := "Scoobi" | |
version := "1-SNAPSHOT" | |
scalaVersion := "2.9.2" | |
scalacOptions ++= Seq("-Ydependent-method-types", "-deprecation") | |
libraryDependencies += "com.nicta" %% "scoobi" % "0.6.0-cdh3-RC2" |
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
package com.gu.scoobi | |
import com.nicta.scoobi.Scoobi._ | |
object ScoobiRemoteCalculation extends ScoobiApp { | |
def run() { | |
val test = onHadoop { | |
scala.math.pow(2, 16) | |
} |
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 intersect(ens: List[Int], ems: List[Int]): List[Int] = (ens, ems) match { | |
case (Nil, _) => Nil | |
case (_, Nil) => Nil | |
case (en :: ensTail, em :: emsTail) if en == em => en :: intersect(ensTail, emsTail) | |
case (en :: ensTail, em :: _) if en < em => intersect(ensTail dropWhile { _ < em }, ems) | |
case (en :: _, em :: emsTail) => intersect(ens, emsTail dropWhile { _ < en }) | |
} | |
intersect(List(1, 2, 3, 4), List(3, 4, 5, 6)) // = List(3, 4) | |
intersect(List(3, 4, 5, 6), List(1, 2, 3, 4)) // = List(3, 4) |
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
implicit def seq2Distinct[T, C[T] <: Seq[T]](tees: C[T]) = new { | |
import collection.generic.CanBuildFrom | |
import collection.mutable.{HashSet => MutableHashSet} | |
def distinctBy[S](hash: T => S)(implicit cbf: CanBuildFrom[C[T],T,C[T]]): C[T] = { | |
val builder = cbf() | |
val seen = MutableHashSet[S]() | |
for (t <- tees) { | |
if (!seen(hash(t))) { |
OlderNewer