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.thoughtworks.scalazMonadFactory | |
import scala.language.experimental.macros | |
import scala.annotation.{tailrec, compileTimeOnly} | |
import scala.language.implicitConversions | |
import scala.language.higherKinds | |
import scalaz.Applicative | |
object ComprehensionApplicative { |
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
Last login: Mon Mar 30 10:36:40 on ttys004 | |
netstat -nr | |
➜ ~ netstat -nr | |
Routing tables | |
Internet: | |
Destination Gateway Flags Refs Use Netif Expire | |
default 10.29.0.253 UGSc 32 17 en0 | |
default link#10 UCSI 0 0 utun0 | |
10.12/16 10.101.19.217 UGSc 0 0 utun0 |
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
<title>Jenkins [Jenkins]</title><link rel="stylesheet" type="text/css" href="/static/bd18d8f9/css/style.css" /><link rel="stylesheet" type="text/css" href="/static/bd18d8f9/css/color.css" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/static/bd18d8f9/favicon.ico" /><script>var isRunAsTest=false; var rootURL=""; var resURL="/static/bd18d8f9";</script><script src="/static/bd18d8f9/scripts/prototype.js" type="text/javascript"></script><script src="/static/bd18d8f9/scripts/behavior.js" type="text/javascript"></script><script src='/adjuncts/bd18d8f9/org/kohsuke/stapler/bind.js' type='text/javascript'></script><script src="/static/bd18d8f9/scripts/yui/yahoo/yahoo-min.js"></script><script src="/static/bd18d8f9/scripts/yui/dom/dom-min.js"></script><script src="/static/bd18d8f9/scripts/yui/event/event-min.js"></script><script src="/static/bd18d8f9/scripts/yui/animation/animation-min.js"></script><script src="/static/bd18d8f9/scripts/yui/dragdrop/dragdrop-min.js"></script><script src="/static/b |
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 | |
REMOTE=play@SERVER_IP | |
REMOTE_APP=/home/play/PROJECT_NAME/ | |
sbt stage || exit 1; | |
rsync -va target/ $REMOTE:$REMOTE_APP/target; | |
ssh $REMOTE "cd $REMOTE_APP; ./stop.sh"; | |
ssh $REMOTE "cd $REMOTE_APP; ./start.sh"; |
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 Account(userId:String, money: Int) | |
trait Converter { | |
def convert(number:Int):Int = number | |
} | |
trait Add10Converter extends Converter { | |
override def convert(number:Int) = super.convert(2*number) | |
} |
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.io.Source.stdin | |
object App { | |
def main(args: Array[String]) { | |
stdin.getLines foreach { line => | |
println(myconvert(line.toInt)) | |
} | |
} | |
val double = (number:Int) => 2*number |
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 double(number:Int) = 2*number | |
def add10(number:Int) = 10 + number | |
def negative(number:Int) = -1 * number | |
def myconvert(n:Int) = Some(n).map(double).map(add10).map(negative).get | |
myconvert(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
// curry的一个意义是: 方便scala根据第一组参数的内容,推断后面的类型 | |
// scala采用基于流的局部推断,只会从第一组参数中获取类型信息,再用到其它组参数里 | |
// 下面只有sort2不用写Int类型 | |
def sort[T](f: (T,T)=>Boolean)(list:List[T]):List[T] = list | |
sort[Int]((x,y)=>true)(List(1,2,3)) | |
def sort2[T](list:List[T])(f: (T,T)=>Boolean):List[T] = list |
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
// curry的一个意义是: 方便scala根据第一组参数的内容,推断后面的类型 | |
// scala采用基于流的局部推断,只会从第一组参数中获取类型信息,再用到其它组参数里 | |
// 下面只有sort2不用写Int类型 | |
def sort[T](f: (T,T)=>Boolean)(list:List[T]):List[T] = list | |
sort[Int]((x,y)=>true)(List(1,2,3)) | |
def sort2[T](list:List[T])(f: (T,T)=>Boolean):List[T] = list |
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
int led = 13; | |
int x = 4; | |
void setup() { | |
pinMode(led, OUTPUT); | |
pinMode(x, INPUT); | |
} | |
void loop() { | |
int sta = digitalRead(x); |