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
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -Xincgc -Xmx1024M -Xms1024M -Didea.launcher.port=7532 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 14.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Deploy.bundle/Contents/Resources/Java/deploy.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/dt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Deploy.bundle/Contents/Resources/Java/javaws.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/management-agent.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/sa-jdi.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/alt-rt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/charsets.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/classes.jar:/System/L |
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> case class A(a: Int, b: Int) | |
defined class A | |
scala> val as = Seq(A(1, 100), A(2, 100), A(3, 101)) | |
as: Seq[A] = List(A(1,100), A(2,100), A(3,101)) | |
scala> as.groupBy(_.b) | |
res3: scala.collection.immutable.Map[Int,Seq[A]] = Map(101 -> List(A(3,101)), 100 -> List(A(1,100), A(2,100))) | |
scala> res3.map{case (b, as) => b -> as.map(_.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
<xs:complexType name="NewSshServer"> | |
<xs:all> | |
<xs:element name="uuid" type="xs:string"/> | |
<xs:element name="hostname" type="xs:string"/> | |
<xs:element name="username" type="xs:string"/> | |
<xs:element name="password" type="xs:string"/> | |
</xs:all> | |
</xs:complexType> | |
case class NewSshServer(uuid: Option[String] = None, |
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 org.example.snippet | |
import scala.xml.NodeSeq | |
class Tree { | |
def render = { | |
case class N(label: String, children: Seq[N]) | |
def renderTree(node: N): NodeSeq = { | |
<li> | |
{node.label} |
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 add(n1: Int, n2: Int) = n1 + n2 | |
def mult(n1: Int, n2: Int) = n1 * n2 | |
val opers = Map( | |
"+" -> add _, | |
"*" -> mult _ | |
) | |
println("Enter expressions like 23 * 10 or 2 - 5") |
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
generated /xx/schema/target/scala-2.10.1/src_managed/main/p/UsageMeter.scala. | |
generated /xx/schema/target/scala-2.10.1/src_managed/main/p/xmlprotocol.scala. | |
generated /xx/schema/target/scala-2.10.1/src_managed/main/scalaxb/scalaxb.scala. | |
[info] Compiling 3 Scala sources to /xx/schema/target/scala-2.10.1/classes... | |
[warn] /xx/schema/target/scala-2.10.1/src_managed/main/scalaxb/scalaxb.scala:402: fruitless type test: a value of type scala.xml.Node cannot also be a scala.xml.UnprefixedAttribute | |
[warn] case attr: UnprefixedAttribute => | |
[warn] ^ | |
[warn] /xx/schema/target/scala-2.10.1/src_managed/main/scalaxb/scalaxb.scala:405: fruitless type test: a value of type scala.xml.Node cannot also be a scala.xml.PrefixedAttribute | |
[warn] case attr: PrefixedAttribute => | |
[warn] ^ |
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 notify = function(msg) { | |
$('#event').empty().append(msg); | |
}; | |
var numFollowers = function() { | |
return $('#followers').children().length; | |
}; | |
var setNumFol = function() { | |
$('#numfol').empty().append(numFollowers()); |
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 Dog(name: String, tailLength: Option[Int]) | |
val dogs = Seq(Dog("Sparky", Some(85)), Dog("Rotty", None)) | |
val (dogsWithTails, dogsWithoutTails) = dogs.partition(_.tailLength.isDefined) | |
if (! dogsWithoutTails.isEmpty) | |
println("These dogs are missing tails: " + | |
dogsWithoutTails.map(_.name).mkString(", ")) | |
dogsWithTails.map(dog => { |
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
val unions = Seq(4->3, 3->8, 6->5, 9->4, 2->1, 5->0, 7->2, 6->1, 1->0) | |
val parents = (0 to 9).toArray | |
val depths = Array.fill(10)(1) | |
def connected(p: Int, q: Int) = root(p) == root(q) | |
def union(p: Int, q: Int) { | |
val i = root(p) | |
val j = root(q) | |
val (sm, lg) = if (depths(i) < depths(j)) (i, j) else (j, i) |
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
object MyBuild extends Build { | |
import BuildSettings._ | |
val custom = TaskKey[Unit]("custom", "Does custom processing") | |
val customTask = custom := { | |
Process("./a-script.sh %s".format(warFilePath), "a directory") ! | |
} | |
} |