Skip to content

Instantly share code, notes, and snippets.

object ScalaBasicRunner extends Baysick with Application {
10 PRINT "Scala"
20 LET ('number := 1)
30 IF 'number > 0 THEN 50
40 PRINT "Java"
50 PRINT "rulez!"
60 END
RUN
}
byte[] obtainByteData(String filename) throws IOException {
InputStream inputStream = getClass().getResourceAsStream(filename);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024);
byte[] bytes = new byte[512];
int readBytes;
while ((readBytes = inputStream.read(bytes)) > 0) {
outputStream.write(bytes, 0, readBytes);
}
// Java library
public final class SomeObjectFactory {
public SomeObject getInstance(String someParam) { ... }
}
// Scala client
class SomeClientClass(sof: SomeObjectFactory) {
def foo(param: String) {
val someObj = sof.getInstance(param)
}
@realbot
realbot / Example.scala
Created May 20, 2011 15:32
Retrying with style
val retryBlock = new Retry[String](6)
import retryBlock.retry
retry {
doSomething(somePar)
} giveup {
case e: Exception => handleException(e)
}
@realbot
realbot / keybase.md
Last active July 26, 2016 08:32
keybase.md

Keybase proof

I hereby claim:

  • I am realbot on github.
  • I am realbot (https://keybase.io/realbot) on keybase.
  • I have a public key whose fingerprint is A5E3 9233 3373 C87A 6787 607F DD70 C6DF 96BD B385

To claim this, I am signing this object: