Skip to content

Instantly share code, notes, and snippets.

Yevgeniy Brikman brikis98

Block or report user

Report or block brikis98

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brikis98
brikis98 / sbt-hooks-for-grunt.js
Created Feb 1, 2014
Some brainstorming on making SBT work with a JS build system, such as grunt.js.
View sbt-hooks-for-grunt.js
var sbtLink = require("sbt-link")
sbtLink.hooks.on("run", function() {
// Initialize grunt or whatever build system.
// You could configure grunt or run grunt watch or precompile everything or do nothing.
grunt.initConfig({
// ...
});
});
View Build.scala
// Note the "with play.PlayInternalKeys"
object ApplicationBuild extends Build with play.PlayInternalKeys {
// Project with NettyServer monkey patch
val monkeyPatch = Project("monkey-patch", file("monkey-patch"))
.settings(libraryDependencies +=
"com.typesafe.play" % "play_2.10" % "2.2.1")
// Actual Play app
val myApp = play.Project("my-app", path = file("my-app"))
View gist:9084215
my-project
└ my-app
└ app
└ conf
└ public
└ test
└ monkey-patch
└ src
└ main
└ scala
View gist:9083205
ab -n 100 -c 51 http://localhost:9000
View gist:9084493
sysctl -w kern.ipc.somaxconn=1024
View TempNettyServer.scala
private def newBootstrap = {
val bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(NamedThreadFactory("netty-boss")),
Executors.newCachedThreadPool(NamedThreadFactory("netty-worker"))))
/////// TEMPORARY WORKAROUND: expose the backlog setting ///////
val backlog =
Option(System.getProperty("http.netty.backlog"))
.map(Integer.parseInt)
View gist:9083511
val bootstrap = new ServerBootstrap(...);
bootstrap.setOption("backlog", 1024);
View gist:9083297
> ab -n 100 -c 51 http://localhost:9000/
This is ApacheBench, Version 2.3
Benchmarking localhost (be patient)...
apr_socket_recv: Connection reset by peer (54)
View Build.scala
// Note the "with play.PlayInternalKeys"
object ApplicationBuild extends Build with play.PlayInternalKeys {
// Project with NettyServer monkey patch
val monkeyPatch = Project("monkey-patch", file("monkey-patch"))
.settings(libraryDependencies +=
"com.typesafe.play" % "play_2.10" % "2.2.1")
// Actual Play app
val myApp = play.Project("my-app", path = file("my-app"))
View gist:9970242
app → Application sources
└ controllers → Application controllers
└ Application.scala → An example controller
└ models → Application business layer
└ views → Templates
build.sbt → Application build script
conf → Configurations files and other non-compiled resources (on classpath)
└ application.conf → Main configuration file
└ routes → Routes definition
public → Public assets
You can’t perform that action at this time.