This file contains hidden or 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 java.util.concurrent.atomic.AtomicReference | |
import java.util.concurrent.{TimeUnit, Executors} | |
import java.util.Date | |
import javax.servlet.http.{HttpServletRequest, HttpServletResponse, HttpServlet} | |
import javax.servlet.{ServletContext, ServletConfig} | |
import org.glassfish.grizzly.comet._ | |
import org.glassfish.grizzly.http.HttpRequestPacket | |
import collection.JavaConversions._ | |
import org.glassfish.grizzly.http.server.{Response, HttpServer} | |
import org.glassfish.grizzly.servlet.ServletHandler |
This file contains hidden or 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 Main { | |
def main(args: Array[String]) { | |
WebServer("src/main/webapp", Config.webServerPort) { server => | |
server.inContext("/api") { context => | |
context.mount("validate", new ValidateApp) | |
context.mount("channels", new MessageChannelApp) | |
context.mount("streams", new StreamsApp) | |
context.mount("", new AccountApp) |
This file contains hidden or 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
require 'rubygems' | |
require 'growl' | |
require 'net/http' | |
require 'net/https' | |
require 'yajl/json_gem' | |
API_KEY="YOUR_API_KEY" | |
STREAM_NAME="controlbox" | |
ICON_PATH="/Users/ivan/Dropbox/Mojolly/design/backchat/apple-touch-icon.png" |
This file contains hidden or 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 java.nio.charset.Charset | |
import java.util.concurrent.{TimeUnit, Executors} | |
import java.util.Date | |
import org.zeromq.ZMQ | |
trait ZeroMQTrials | |
object Server { | |
def main(args: Array[String]) { |
This file contains hidden or 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 ZeroMQPoller { | |
type ZMessageHandler = ZMessage => Unit | |
} | |
class ZeroMQPoller(context: Context) { | |
import ZeroMQPoller._ | |
private var poller: Poller = null | |
private val pollinHandlers = ListBuffer[ZMessageHandler]() |
This file contains hidden or 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
± ivan@azkaban:~ | |
» cd src/scala/specs2 | |
± ivan@azkaban:~/src/scala/specs2 | |
git:(2.9.0-1.4) ✗ » sbt test-compile | |
[info] Building project specs2 1.4-SNAPSHOT against Scala 2.9.0 | |
[info] using Project with sbt 0.7.7 and Scala 2.7.7 | |
[info] | |
[info] == compile == | |
[info] Source analysis: 0 new/modified, 0 indirectly invalidated, 0 removed. | |
[info] Compiling main sources... |
This file contains hidden or 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
export RUBYOPT="rubygems" | |
rvm_install_on_use_flag=1 | |
if [ -z $(rvm gemset list | grep virtmachines) 2> /dev/null ]; then | |
rvm ruby-1.8.7 | |
rvm gemset create virtmachines | |
fi | |
rvm ruby-1.8.7@virtmachines |
This file contains hidden or 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._ | |
import Keys._ | |
import org.sbtidea._ | |
import SbtIdeaPlugin._ | |
import Scope.{GlobalScope, ThisScope} | |
object BuildSettings { | |
val buildOrganization = "com.mojolly.backchat" | |
val buildScalaVersion = "2.9.0-1" | |
val buildVersion = "0.8.1-SNAPSHOT" |
This file contains hidden or 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
type Transformer = Request => Request | |
object OptimusPrime extends Transformer { def apply(req: Request) = req } | |
object Megatron extends Transformer { def apply(req: Request) = throw new RuntimeException("Invalid operation!")} |
This file contains hidden or 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
trait IPv6AddressParser extends RegexParsers { | |
def hexDigit = """[0123456789abcdefABCDEF]""".r | |
def decOctet = """25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d""".r | |
def dottedDecOctet = decOctet <~ "." | |
private def IPv4Address = dottedDecOctet ~ dottedDecOctet ~ dottedDecOctet ~ decOctet ^^ { | |
case a ~ b ~ c ~ d ⇒ a + "." + b + "." + c + "." + d | |
} | |
private def h16_2 = repN(2, hexDigit) |