Archiving a bunch of old stuff
This commit is contained in:
2
oldstuff/scala/official-by-example/.env
Normal file
2
oldstuff/scala/official-by-example/.env
Normal file
@@ -0,0 +1,2 @@
|
||||
HERE=$(dirname "$1")
|
||||
(echo "$PATH" | grep "$HERE/bin" >/dev/null 2>&1) || export PATH="$HERE/bin:$PATH"
|
2
oldstuff/scala/official-by-example/.gitignore
vendored
Normal file
2
oldstuff/scala/official-by-example/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/bin/
|
||||
target/
|
3
oldstuff/scala/official-by-example/byx/build.sbt
Normal file
3
oldstuff/scala/official-by-example/byx/build.sbt
Normal file
@@ -0,0 +1,3 @@
|
||||
name := "byx"
|
||||
|
||||
version := "0.1.0"
|
@@ -0,0 +1,12 @@
|
||||
object sort {
|
||||
def sort(xs: Array[Int]): Array[Int] = {
|
||||
if (xs.length <= 1) xs
|
||||
else {
|
||||
val pivot = xs(xs.length / 2)
|
||||
Array.concat(
|
||||
sort(xs filter (pivot >)),
|
||||
xs filter (pivot ==),
|
||||
sort(xs filter (pivot <)))
|
||||
}
|
||||
}
|
||||
}
|
10
oldstuff/scala/official-by-example/setup
Executable file
10
oldstuff/scala/official-by-example/setup
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p ./bin
|
||||
pushd ./bin
|
||||
curl -O 'https://raw.github.com/paulp/sbt-extras/master/sbt'
|
||||
chmod +x sbt
|
||||
popd
|
||||
./bin/sbt -sbt-create about
|
13
oldstuff/scala/official-tutorial/FrenchDate.scala
Normal file
13
oldstuff/scala/official-tutorial/FrenchDate.scala
Normal file
@@ -0,0 +1,13 @@
|
||||
import java.util.{Date, Locale}
|
||||
import java.text.DateFormat
|
||||
import java.text.DateFormat._
|
||||
|
||||
object FrenchDate {
|
||||
def main(args: Array[String]) {
|
||||
val now = new Date
|
||||
val df = getDateInstance(LONG, Locale.FRANCE)
|
||||
println(df format now)
|
||||
}
|
||||
}
|
||||
|
||||
// vim: set ts=4 sw=4 et:
|
7
oldstuff/scala/official-tutorial/HelloWorld.scala
Normal file
7
oldstuff/scala/official-tutorial/HelloWorld.scala
Normal file
@@ -0,0 +1,7 @@
|
||||
object HelloWorld {
|
||||
def main(args: Array[String]) {
|
||||
println("Hello, World!")
|
||||
}
|
||||
}
|
||||
|
||||
// vim: set ts=4 sw=4 et:
|
1
oldstuff/scala/official-tutorial/README
Normal file
1
oldstuff/scala/official-tutorial/README
Normal file
@@ -0,0 +1 @@
|
||||
Working through http://www.scala-lang.org/docu/files/ScalaTutorial.pdf
|
15
oldstuff/scala/official-tutorial/Timer.scala
Normal file
15
oldstuff/scala/official-tutorial/Timer.scala
Normal file
@@ -0,0 +1,15 @@
|
||||
object Timer {
|
||||
def oncePerSecond(callback: () => Unit) {
|
||||
while (true) { callback(); Thread sleep 1000 }
|
||||
}
|
||||
|
||||
def timeFlies() {
|
||||
println("time flies like an arrow...")
|
||||
}
|
||||
|
||||
def main(args: Array[String]) {
|
||||
oncePerSecond(timeFlies)
|
||||
}
|
||||
}
|
||||
|
||||
// vim: set ts=4 sw=4 et:
|
1
oldstuff/scala/sbt-guide/.env
Normal file
1
oldstuff/scala/sbt-guide/.env
Normal file
@@ -0,0 +1 @@
|
||||
PATH="$PWD/bin:$PATH"
|
2
oldstuff/scala/sbt-guide/.gitignore
vendored
Normal file
2
oldstuff/scala/sbt-guide/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/bin/
|
||||
target/
|
5
oldstuff/scala/sbt-guide/hello/build.sbt
Normal file
5
oldstuff/scala/sbt-guide/hello/build.sbt
Normal file
@@ -0,0 +1,5 @@
|
||||
name := "hello"
|
||||
|
||||
version := "1.0"
|
||||
|
||||
scalaVersion := "2.9.1"
|
3
oldstuff/scala/sbt-guide/hello/src/main/scala/hw.scala
Normal file
3
oldstuff/scala/sbt-guide/hello/src/main/scala/hw.scala
Normal file
@@ -0,0 +1,3 @@
|
||||
object Hi {
|
||||
def main(args: Array[String]) = println("Hi")
|
||||
}
|
0
oldstuff/scala/sbt-guide/lib/.gitkeep
Normal file
0
oldstuff/scala/sbt-guide/lib/.gitkeep
Normal file
10
oldstuff/scala/sbt-guide/setup
Executable file
10
oldstuff/scala/sbt-guide/setup
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p ./bin
|
||||
pushd ./bin
|
||||
curl -O 'https://raw.github.com/paulp/sbt-extras/master/sbt'
|
||||
chmod +x sbt
|
||||
popd
|
||||
./bin/sbt -sbt-create about
|
Reference in New Issue
Block a user