This file contains 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
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=/tmp/output.pdf input1.pdf input2.pdf` |
This file contains 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
// Suggested Wartremover errors to improve inference rules and avoid partial methods which throw | |
wartremoverErrors ++= Seq( | |
Wart.Any, | |
Wart.Any2StringAdd, | |
Wart.EitherProjectionPartial, | |
Wart.OptionPartial, | |
Wart.Product, | |
Wart.Serializable, | |
Wart.ListOps, | |
Wart.Nothing |
This file contains 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
// Adapted from Rob Norris' post at https://tpolecat.github.io/2014/04/11/scalac-flags.html | |
scalacOptions ++= Seq( | |
"-deprecation", | |
"-encoding", "UTF-8", // yes, this is 2 args | |
"-feature", | |
"-unchecked", | |
"-Xfatal-warnings", | |
"-Xlint", | |
"-Yno-adapted-args", |
This file contains 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
String.format() call with mismatched args | |
Unused function argument | |
aList.length == 0 <- use .isEmpty | |
Using string interpolation unnecessarily | |
Calling .toString on Array | |
Close scala.io.Source | |
Inferring Nothing | |
Casting instead of .toByte | |
Calling .toSeq on a Seq | |
Calling .toString on a String |
This file contains 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
Q: some string | |
R: some string |
This file contains 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
<?php | |
/** | |
* Sorts an array based on keys provided by a closure which extracts a value from the array's elements. | |
* | |
* Keys are not preserved. The original is not modified. | |
* | |
* Inspired by Scala's Seq.sortBy() | |
* @see http://www.scala-lang.org/api/current/index.html#scala.collection.Seq | |
* | |
* @param $array array-like To sort. (Really it just needs to be something iterable.) |
This file contains 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
object npr { | |
def main(args: Array[String]) { | |
val digits = "123456789" | |
val numbers = for ( | |
i <- 1 to (digits.length - 3); | |
j <- (i + 1) to (digits.length - 2); | |
k <- (j + 1) to (digits.length - 1) | |
) yield Seq( | |
digits.substring(0,i), | |
digits.substring(i,j), |
This file contains 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
import org.apache.hadoop.fs.Path | |
import org.apache.hadoop.hbase.io.hfile.{HFile,HFileScanner} | |
import org.apache.hadoop.hbase.io.hfile.HFile.Reader | |
import org.apache.hadoop.hbase.io.ImmutableBytesWritable | |
import org.apache.hadoop.hbase.KeyValue | |
import org.apache.hadoop.mapreduce.{JobContext,InputSplit,TaskAttemptContext,RecordReader} | |
import org.apache.hadoop.mapreduce.lib.input.{FileInputFormat,FileSplit} | |
class HFileInputFormat extends FileInputFormat[ImmutableBytesWritable, KeyValue] { | |
override def isSplitable(context: JobContext, file: Path): Boolean = false |
This file contains 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
object typeErasure { | |
def main(args: Array[String]) { | |
val evenOdd = 1.to(10) | |
.map{x => if (x%2==0) { Option[Int](x) } else { None } } | |
.partition{ case Some(_) => true case _ => false } | |
println(evenOdd) | |
} | |
} |