This file contains hidden or 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 hi { | |
| println("hello world") | |
| } |
This file contains hidden or 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> def sum(x: Int, y: Int) = x + y | |
| sum: (x: Int, y: Int)Int | |
| scala> def plus1 = sum(_: Int, 1) | |
| plus1: (Int) => Int | |
| scala> plus1(2) | |
| res0: Int = 3 | |
| scala> def plus2 = sum(2, _: Int) |
This file contains hidden or 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
| Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24). | |
| Type in expressions to have them evaluated. | |
| Type :help for more information. | |
| scala> class A { println("A") } | |
| defined class A | |
| scala> class B extends A { println("B") } | |
| defined class B |
This file contains hidden or 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 Math._ | |
| // random number in range 1 - 5 | |
| def rnd5 = (floor(random * 5) + 1).toLong | |
| // random bit | |
| def rndbit: Long = { | |
| val i = rnd5 | |
| if (i == 1 || i == 2) 0L | |
| else if (i == 3 || i == 4) 1L |
This file contains hidden or 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> class Test { object Obj } | |
| defined class Test | |
| scala> (new Test).Obj | |
| res0: object Test#Obj = Test$Obj$@6e929b52 | |
| scala> (new Test).Obj | |
| res1: object Test#Obj = Test$Obj$@46b44bc2 |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Ansi 0 Color</key> | |
| <dict> | |
| <key>Blue Component</key> | |
| <real>0.11764705926179886</real> | |
| <key>Green Component</key> | |
| <real>0.11372549086809158</real> |
This file contains hidden or 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
| set number | |
| set incsearch | |
| set hlsearch | |
| syntax enable | |
| :colorscheme evening |
This file contains hidden or 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> import com.eaio.util.text.HumanTime.{approximately => ht} | |
| import com.eaio.util.text.HumanTime.{approximately=>ht} | |
| scala> ht(0) | |
| res0: java.lang.String = "" | |
| scala> ht(1) | |
| res1: java.lang.String = 1 ms | |
| scala> ht(1000) |
This file contains hidden or 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
| Map<String, String> map = new HashMap<String, String() {{ | |
| add("foo", "bar"); | |
| add("name", "landon"); | |
| }}; |
This file contains hidden or 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 | |
| ls -lrt | awk '{ f=$NF }; END{ print f }' |
OlderNewer