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 under test */ | |
package net.rafaelferreira | |
case class Street(streetName: String) | |
case class City(name:String) | |
case class Address(city:City, street:Street) | |
trait AddressMapper { | |
def map(id:String): Option[Address] | |
} |
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
#! /bin/bash | |
function find_proj_from() { | |
if [[ $1 == '/' ]] || [[ -z $1 ]] ; then | |
return | |
fi | |
if [[ -e $1/.git ]]; then | |
FOUND_PROJ_AT=$1 | |
return |
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
Busca instancia da classe Contador do banco --- banco.find[Contador](chuchu) -- gerando "select value, id from Contador where id = chuchu)" | |
Gera uma nova instancia "atualizada" --- val novoContador = contador.increment() | |
Salva essa nova instanca --- banco.save(novoContador) |
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
rafael@ferreiranote:~$ curl www.fflch.usp.br | |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<html> | |
<head> | |
<title>Redirecinando para o novo site</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | |
<meta http-equiv="refresh" content="1;URL=http://fflch.usp.br"> | |
</head> | |
<body> |
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> out(t2)(tupInContainer[ECons[In, ECons[In, ECons[In, ENilClass,ENilClass], ECons[In, ENilClass,ENilClass]], | |
| ECons[In, ECons[In, ENilClass,ENilClass], ECons[In, ENilClass,ENilClass]]], Tuple2[In,In]](t2ToEList[In,In])) | |
<console>:25: error: polymorphic expression cannot be instantiated to expected type; | |
found : => ((H.In, H.In)) => H.ECons[H.In,H.ECons[H.In,H.ENilClass,H.ENilClass],H.ECons[H.In,H.ENilClass,H.ENilClass]] | |
required: ((H.In, H.In)) => H.ECons[H.In,H.ECons[H.In,H.ECons[H.In,H.ENilClass,H.ENilClass],H.ECons[H.In,H.ENilClass,H.ENilClass]],H.ECons[H.In,H.ECons[H.In,H.ENilClass,H.ENilClass],H.ECons[H.In,H.ENilClass,H.ENilClass]]] | |
ECons[In, ECons[In, ENilClass,ENilClass], ECons[In, ENilClass,ENilClass]]], Tuple2[In,In]](t2ToEList[In,In])) | |
^ |
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 test | |
import java.lang.String | |
object Capa { | |
import java.io._ | |
def criaNovo() = { | |
val arquivo = new File("capa.html") | |
if (arquivo.exists) { | |
arquivo.delete; |
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 happy_?(i:Int) = { | |
def sumOfSquares(n:Int) = n.toString.map(_ - '0').map(d=>d*d).sum | |
val numbers = Stream.iterate(i)(sumOfSquares) | |
def contents:Stream[Set[Int]] = Set[Int]() #:: (numbers zip contents).map{case (n, s) => s + n} | |
val stopNumber = (numbers zip contents) find {case (n,s) => n == 1 || s.contains(n)} | |
stopNumber match {case Some((1,_)) => "happy"; case _ => "sad"} | |
} | |
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
class T { | |
val t = "T" | |
} | |
class U | |
class V | |
object T { | |
implicit def UToT[UU <% U](u: UU) = new T | |
} |
NewerOlder