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
// First you need to create module with actor system and actor bindings in it: | |
// IMPORTANT: `Actor` bindings should always be providers (bound with `toProvider` method, | |
// IMPORTANT: which will create new instances each time it gets injected) | |
implicit val module = new Module { | |
bind [ActorSystem] to ActorSystem("MySystem") | |
bind [GreetPrinter] toProvider new GreetPrinter | |
binding toProvider new GenericPrinter | |
bind [PrintStream] to Console.out |
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 scala.annotation.switch | |
import org.parboiled2._ | |
import scala.io.Source | |
import scala.util.{Failure, Success} | |
class PredicateParser(val input: ParserInput) extends Parser with CommonRules { | |
def And = Keyword("and") | |
def Or = Keyword("or") | |
def Not = Keyword("not") |
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
println("Sorted: " + list.sortBy(_.balance)) | |
println("Max: " + list.maxBy(_.balance)) | |
println("Min: " + list.minBy(_.balance)) |
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
// In your project | |
// General stuff like name, description, version | |
// Publishing | |
publishMavenStyle := true | |
publishArtifact in Test := false | |
pomIncludeRepository := (_ => false) | |
publishTo := Some( |
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 sbt._ | |
object PluginDef extends Build { | |
override def projects = Seq(root) | |
lazy val root = Project("plugins", file(".")) dependsOn (ghpages, pamflet) | |
lazy val ghpages = uri("git://github.com/jsuereth/xsbt-ghpages-plugin.git") | |
lazy val pamflet = uri("git://github.com/n8han/pamflet-plugin#0.3.0") | |
} |
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 com.jsuereth.sbtsite.SiteKeys | |
// add all setting from the site plugin to the project | |
seq(site.settings: _*) | |
// add all setting from the ghpages plugin to the project | |
seq(ghpages.settings: _*) | |
// read-only git repository URI of the current project | |
git.remoteRepo := "git://github.com/OlegIlyenko/scaldi.git" |
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
$ cd /path/to/fancypants | |
$ git symbolic-ref HEAD refs/heads/gh-pages | |
$ rm .git/index | |
$ git clean -fdx |
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 math._ | |
case class Progress(percent: Int, size: Long, remains: Long, done: Long, bps: Long, elapsed: Long, estimated: Long) { | |
lazy val formattedMetrics= List( | |
"Progress: " + percent + "%", | |
"File size: " + formatSize(size), | |
"Downloaded: " + formatSize(done), | |
"Remains: " + formatSize(remains), | |
"Speed: " + (bps / 1024) + " kb/s", | |
"Elapsed: " + formatTime(elapsed), |
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 javax.swing.UIManager | |
import java.net.URL | |
import java.awt.Dimension | |
import java.io.Closeable | |
import swing._ | |
object Downloader extends SimpleSwingApplication { | |
UIManager.getInstalledLookAndFeels | |
.filter(_.getName contains "Nimbus").headOption |
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
package scaldi.keys | |
import math._ | |
import swing._ | |
import java.io.{Closeable, InputStream, FilterInputStream} | |
import javax.swing.UIManager | |
import java.net.URL | |
object Downloader extends SimpleSwingApplication { |
OlderNewer