(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/bin/sh | |
# ngrok's web interface is HTML, but configuration is bootstrapped as a JSON | |
# string. We can hack out the forwarded hostname by extracting the next | |
# `*.ngrok.io` string from the JSON | |
# | |
# Brittle as all get out--YMMV. If you're still reading, usage is: | |
# | |
# $ ./ngrok_hostname.sh <proto> <addr> | |
# |
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
# This is how I upload my new Sol Trader builds (http://soltrader.net) | |
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
S3KEY="my aws key" | |
S3SECRET="my aws secret" # pass these in | |
function putS3 | |
{ | |
path=$1 |
val n = 9 | |
val s = Math.sqrt(n).toInt | |
type Board = IndexedSeq[IndexedSeq[Int]] | |
def solve(board: Board, cell: Int = 0): Option[Board] = (cell%n, cell/n) match { | |
case (r, `n`) => Some(board) | |
case (r, c) if board(r)(c) > 0 => solve(board, cell + 1) | |
case (r, c) => | |
def guess(x: Int) = solve(board.updated(r, board(r).updated(c, x)), cell + 1) | |
val used = board.indices.flatMap(i => Seq(board(r)(i), board(i)(c), board(s*(r/s) + i/s)(s*(c/s) + i%s))) |
def reverseProxy = Action.async(parse.raw) { | |
request: Request[RawBuffer] => | |
// Create the request to the upstream server: | |
val proxyRequest = | |
WS.url("http://localhost:8887" + request.path) | |
.withFollowRedirects(false) | |
.withMethod(request.method) | |
.withVirtualHost("localhost:9000") | |
.withHeaders(flattenMultiMap(request.headers.toMap): _*) | |
.withQueryString(request.queryString.mapValues(_.head).toSeq: _*) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
package wrappers | |
import play.api._ | |
import play.api.mvc._ | |
import scala.concurrent._ | |
import scala.concurrent.Future | |
import play.mvc.Http.Status | |
import ExecutionContext.Implicits.global | |
import play.libs.Akka | |
import akka.actor.{Actor, Props} |
package com.varun.perculator; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.apache.lucene.analysis.Analyzer; | |
import org.apache.lucene.analysis.core.SimpleAnalyzer; | |
import org.apache.lucene.index.Term; | |
import org.apache.lucene.index.memory.MemoryIndex; | |
import org.apache.lucene.queryparser.classic.ParseException; |
object Put extends Controller { | |
def index = DecodeProtobuf(classOf[MyProtobuf]) { stack :MyProtobuf => | |
Action { | |
// do something with stack | |
} | |
} | |
} |
/** | |
* DSL for imagemagick-style geometry strings | |
* See http://www.imagemagick.org/Magick++/Geometry.html for description | |
* Note: offesets are not supported | |
* | |
* Implements following constructs | |
* | |
* <width> x <height> - Rect | |
* <Rect> <Qualifier> (where qualifier is !/%/>/<) - Geometry | |
* |