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
| // long download: https://downloads.gradle.org/distributions/gradle-2.3-src.zip | |
| // short download: https://repo1.maven.org/maven2/com/ning/async-http-client/1.9.20/async-http-client-1.9.20.jar | |
| // dependencies: see build.sbt | |
| // usage: val f = download(url, localFileName) | |
| // to cancel (if desired): f.cancel(true) | |
| import com.ning.http.client._ | |
| import com.ning.http.client.listener._ |
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/sh | |
| # installation script for Android SDK and JDK 8 on Ubuntu | |
| # for Android development with gradlew-based projects | |
| # tested on Cloud9 | |
| ANDROID_HOME=$HOME/lib/android-sdk-linux | |
| ANDROID_SDK_VERSION=24.4.1 | |
| ANDROID_BUILD_TOOLS_VERSION=23.0.2 | |
| ANDROID_API_LEVEL=22 |
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/sh | |
| # installation script for Scala sbt on Ubuntu | |
| # tested on Codenvy | |
| sudo apt-get update | |
| sudo apt-get install -y apt-transport-https | |
| echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list | |
| sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 |
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
| // http://underscore.io/blog/posts/2015/04/14/free-monads-are-simple.html | |
| // updated version for scalaz 7.2.x where Free automatically applies the | |
| // Coyoneda transform | |
| import scalaz.{Free, ~>, Id} | |
| import scalaz.std.list._ | |
| import scalaz.syntax.traverse._ | |
| type UserId = Int | |
| type UserName = String |
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 zeroTo: GenericCoalgebra[Int, Option, Int] = n => { | |
| require { n >= 0 } | |
| if (n == 0) (0, None) | |
| else (n, Some(n - 1)) | |
| } | |
| val treeFromInt: GenericCoalgebra[Int, List, Int] = n => { | |
| require { n >= 0 } | |
| if (n == 0) (0, List.empty) | |
| else (n, List(n - 1, n - 1)) |
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
| // see also https://www.implicitdef.com/2015/11/19/comparing-scala-http-client-libraries.html | |
| // task: use the prime checker webservice | |
| // https://github.com/LoyolaChicagoCode/primenumbers-spray-scala | |
| // to count the number of primes within a given range | |
| /* instructions: create a build.sbt file in your project root folder containing the following lines: | |
| scalaVersion := "3.3.3" |
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/sh | |
| export ANDROID_HOME=/projects/Android/sdk | |
| mkdir -p $ANDROID_HOME | |
| cd $ANDROID_HOME | |
| wget https://dl.google.com/android/repository/tools_r25.2.3-linux.zip | |
| unzip -q tools_r25.2.3-linux.zip | |
| $ANDROID_HOME/tools/bin/sdkmanager --update |
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
| #!/usr/bin/env python | |
| from bs4 import BeautifulSoup | |
| soup = BeautifulSoup(open("target/site/surefire-report.html"), "html.parser") | |
| table = soup.find("table") | |
| headings = [th.get_text() for th in table.find("tr").find_all("th")] | |
| row = table.find_all("tr")[1] | |
| dataset = [td.get_text() for td in row.find_all("td")] |