Skip to content

Instantly share code, notes, and snippets.

View tototoshi's full-sized avatar

Toshiyuki Takahashi tototoshi

View GitHub Profile
var casper = require('casper').create();
casper.cli.drop("cli");
casper.cli.drop("casper-path");
if (casper.cli.args.length === 0 && Object.keys(casper.cli.options).length === 0) {
casper.echo('Usage: phantomjs download-java.js <name of file to download>');
casper.echo('Example: phantomjs download-java.js jdk-7u45-linux-x64.rpm');
casper.exit(1);
}
@eamelink
eamelink / transformers.scala
Last active November 26, 2021 15:36
Working with Eithers in Futures
import scala.concurrent.Future
object either {
// Scala standard library Either is sometimes used to distinguish between 'failure' and 'success' state. Like these two methods:
def getUser(id: String): Either[String, User] = ???
def getPreferences(user: User): Either[String, Preferences] = ???
// The Right side contains the success value by convention, because right is right, right?