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
| *.suo | |
| *.obj | |
| *.pdb | |
| *.user | |
| *.vspscc | |
| *.bak | |
| *.cache | |
| *.log | |
| *.lib | |
| [Bb]in |
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
| a.out | |
| *.swp | |
| *.o | |
| *.orig | |
| *.hi | |
| *.lkshs | |
| *.iml | |
| .idea/ | |
| dist/ | |
| out/ |
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 | |
| # put in ~/.curlrc: user=BintrayUser:BintrayAPIKey | |
| ORG=$1 | |
| PACKAGE=$2 | |
| curl -i -H "Content-Type: application/json" -d "{ \"name\":\"${PACKAGE}\",\"labels\":[\"android\",\"scala\",\"cse\",\"mobile\",\"oop\",\"designpatterns\"],\"website_url\":\"http://lucoodevcourse.github.io\",\"issue_tracker_url\":\"https://github.com/${ORG}/${PACKAGE}/issues\",\"github_repo\":\"${ORG}/${PACKAGE}\",\"github_release_notes_file\":\"README.md\",\"public_download_numbers\":true,\"public_stats\":true,\"vcs_url\":\"https://github.com/${ORG}/${PACAKGE}\",\"licenses\":[\"MIT\"] }" https://bintray.com/api/v1/packages/${ORG}/generic |
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 pi(n: Long): Double = { | |
| var i = 0L | |
| var c = 0L | |
| while (i < n) { | |
| val x = math.random | |
| val y = math.random | |
| if (x * x + y * y <= 1) c += 1 | |
| i += 1 | |
| } | |
| 4.0 * c / n |
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 | |
| # Download and run this script in a Codio terminal. | |
| # (Workaround for Codio included at the bottom.) | |
| # | |
| # You should set these variables in /home/codio/.bashrc: | |
| # | |
| # export ANDROID_HOME=$HOME/android-sdk-linux | |
| # export LD_LIBRARY_PATH=$HOME/lib32:$LD_LIBRARY_PATH | |
| # |
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
| val lines = scala.io.Source.stdin.getLines | |
| var count = 0 | |
| for (l <- lines) { | |
| println(l) | |
| count += 1 | |
| } | |
| println("count = " + count) |
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 f(i: Int) = i * i | |
| f: (i: Int)Int | |
| scala> Iterator.iterate(2)(f) | |
| res11: Iterator[Int] = non-empty iterator | |
| scala> res11 takeWhile { _ < 10 } foreach { println } | |
| 2 | |
| 4 |
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
| Iterator continually { | |
| // ... | |
| reader.readLine() | |
| } takeWhile { | |
| Option(_).isDefined | |
| } foreach { | |
| processExpr | |
| } | |
| replaces |
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
| // libraryDependencies += "org.neo4j" % "neo4j" % "2.2.0-RC01" | |
| // libraryDependencies += "com.jsuereth" %% "scala-arm" % "1.4" | |
| import org.neo4j.graphdb._ | |
| import org.neo4j.graphdb.factory._ | |
| import resource._ | |
| import scala.collection.JavaConversions._ // for using ResourceIterator in a for comprehension | |
| val graphDb = new GraphDatabaseFactory().newEmbeddedDatabase("db1") |
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
| struct ListNode { value, next }; | |
| var n; | |
| var h; | |
| var s; | |
| n = new ListNode; | |
| h = n; | |
| n.value = 2; | |
| n.next = new ListNode; | |
| n = n.next; | |
| n.value = 3; |
OlderNewer