Skip to content

Instantly share code, notes, and snippets.

Adam Warski adamw

Block or report user

Report or block adamw

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
View Dockerfile
# 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 /
View Vagrantfile
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"
View build-docker-image.sh
#!/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
View Sender.scala
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")
View Receiver.scala
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)
View SqsMq.scala
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 {
View Sender.scala
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 Aug 29, 2015
Classifiers in MacWire
View gist:46c6550a6444156b434e
/*
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) {
View gist:5f68795f90b34abf7df1
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.
View gist:3080a568e05c4f4529e1
new SuplerForm(document.getElementById("container"), {
field_options: {
"age": {
// define render hint on frontend
"render_hint": "number"
},
"dateOfBirth": {
"after_render": function(inputElement, containerElement) {
$(inputElement).datepicker();
}
You can’t perform that action at this time.