Skip to content

Instantly share code, notes, and snippets.

View adamw's full-sized avatar

Adam Warski adamw

View GitHub Profile
# VERSION 1.0
# the base image is a trusted ubuntu build with java 7 (https://index.docker.io/u/dockerfile/java/)
FROM dockerfile/java
# that's me!
MAINTAINER Adam Warski, adam@warski.org
# we need this because the workdir is modified in dockerfile/java
WORKDIR /
#!/bin/sh
function copy_if_changed {
local path_from="$2/$1"
local path_to="$3/$1"
local md5_from=$(md5 -q $path_from)
if [ -e $path_to ]
then
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# http://www.vagrantbox.es/
config.vm.box = "ubuntu-12.04-docker"
config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-12.04-amd64-vbox.box"
# Sets the ip we'll use to access the box
config.vm.network :private_network, ip: "10.0.0.10"
config.vm.hostname = "myapp"
package com.softwaremill.mqperf
import com.softwaremill.mqperf.mq.Mq
import scala.util.Random
import com.softwaremill.mqperf.config.TestConfigOnS3
object Sender extends App {
new TestConfigOnS3().whenChanged { testConfig =>
println(s"Starting test (sender) with config: $testConfig")
package com.softwaremill.mqperf
import com.softwaremill.mqperf.config.TestConfigOnS3
import com.softwaremill.mqperf.mq.Mq
object Receiver extends App {
new TestConfigOnS3().whenChanged { testConfig =>
println(s"Starting test (receiver) with config: $testConfig")
val mq = Mq.instantiate(testConfig)
package com.softwaremill.mqperf.mq
import com.amazonaws.services.sqs.buffered.AmazonSQSBufferedAsyncClient
import com.amazonaws.services.sqs.AmazonSQSAsyncClient
import scala.collection.JavaConverters._
import com.amazonaws.services.sqs.model.{DeleteMessageRequest, ReceiveMessageRequest, SendMessageBatchRequestEntry}
import com.softwaremill.mqperf.config.AWSCredentialsFromEnv
import com.amazonaws.regions.{Region, Regions}
class SqsMq(configMap: Map[String, String]) extends Mq {
val serverLocator = {
val nettyParams = new java.util.HashMap[String, Object]()
nettyParams.put(TransportConstants.HOST_PROP_NAME, "localhost")
nettyParams.put(TransportConstants.PORT_PROP_NAME, "5445")
val sl = HornetQClient.createServerLocatorWithHA(
new TransportConfiguration(classOf[NettyConnectorFactory].getName, nettyParams))
sl.setConfirmationWindowSize(1048576)
@adamw
adamw / gist:46c6550a6444156b434e
Last active August 29, 2015 14:10
Classifiers in MacWire
/*
A proposition on how classifiers can be implemented in MacWire. Based on @milessabin's https://gist.github.com/milessabin/89c9b47a91017973a35f
*/
// Infrastructure: would come in the library
// note that no changes in the macro are necessary. The qualifiers are purely type-based
type Tag[U] = { type Tag = U }
type @@[T, U] = T with Tag[U]
type Tagged[T, U] = T with Tag[U]
implicit class Tagger[T](t: T) {
@adamw
adamw / gist:5f68795f90b34abf7df1
Last active August 29, 2015 14:11
Supler actions
def carForm(removeAction: Car => ActionResult[Car]) = form[Car](f => List(
f.field(_.make).possibleValues(_ => carMakesAndModels.keys.toList).label("Make"),
// etc.
// trait Form[T] { def action(T => ActionResult[T]): Row[T] }
f.action(removeAction).label("Delete")
))
val personForm = form[Person](f => List)
f.field(_.firstName).label("label_person_firstname"),
// etc.
new SuplerForm(document.getElementById("container"), {
field_options: {
"age": {
// define render hint on frontend
"render_hint": "number"
},
"dateOfBirth": {
"after_render": function(inputElement, containerElement) {
$(inputElement).datepicker();
}