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 FiboFunc { | |
val fibs:Stream[BigInt] = | |
0 #:: 1 #:: (fibs zip fibs.tail).map{ case (a,b) => a+b } | |
def main(args: Array[String]) = println(fibs(1000)); | |
} |
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 object Calcule | |
case object Pare | |
class Calculador extends Actor { | |
val rand = new Random | |
var pi, in, cnt = 1.0 | |
def act() { | |
while (true) { | |
receive { //aguarda uma mensagem |
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 Colecoes extends Application { | |
val lista = List.range(-5, 5) | |
CollectionUtils.forAllDo( | |
CollectionUtils.collect( | |
CollectionUtils.select(lista, | |
new Predicate() { | |
def evaluate(obj: Object): Boolean = | |
return obj.asInstanceOf[Int] > 0; | |
}), new Transformer() { |
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 + + [B>: A, That] (that: TraversableOnce [B]) (implicit bf: CanBuildFrom [List [A], B, That]): That |
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 Colecoes extends Application { | |
val myList = List.range(-5, 5) | |
CollectionUtils.forAllDo( | |
CollectionUtils.collect( | |
CollectionUtils.select(myList, | |
new Predicate() { | |
def evaluate(obj: Object): Boolean = | |
return obj.asInstanceOf[Int] > 0; | |
}), new Transformer() { |
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
/* | |
Hello, this is a first attempt to write a reactive app. | |
It should deploy a static website to AWS S3. | |
After creating the bucket, it should put the public bucket policy, | |
configure the bucket website and upload the files in parallel. | |
putBucketPolicy | |
createBucket -> putBucketWebsite | |
uploadFiles -> upload index.html |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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((x,i) <- xs.view.zipWithIndex) println("String #" + i + " is " + x) |
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
AmazonS3Client s3 = new AmazonS3Client(); | |
String bucketName = "deleteversions-"+UUID.randomUUID(); | |
//Creates Bucket | |
s3.createBucket(bucketName); | |
//Enable Versioning | |
BucketVersioningConfiguration configuration = new BucketVersioningConfiguration(ENABLED); | |
s3.setBucketVersioningConfiguration(new SetBucketVersioningConfigurationRequest(bucketName, configuration )); |
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
import scala.collection.JavaConverters._ | |
import com.amazonaws.services.s3.AmazonS3Client | |
import rx.lang.scala._ | |
import rx.lang.scala.schedulers._ | |
import com.amazonaws.services.s3.model._ | |
/** | |
* @author jfaerman | |
*/ |
OlderNewer