Skip to content

Instantly share code, notes, and snippets.

View evbruno's full-sized avatar

Eduardo V. Bruno evbruno

View GitHub Profile
@evbruno
evbruno / Dockerfile
Created August 4, 2016 20:16
Dockerfile derived from official PostgreSQL with rvm/ruby/rails
### Container based on official postgres v9.5.3, with:
# * rvm
# * ruby 2.2.3
# * rails 4.2.3
###
FROM postgres:9.5.3
RUN apt-get update && apt-get install -y curl git libpq-dev
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
@evbruno
evbruno / HttpApp.scala
Created February 25, 2016 18:34
Posting a JSON content with http4s / scalaz
// build.sbt
// "org.http4s" %% "http4s-client" % "0.12.3",
// "org.http4s" %% "http4s-blaze-client" % "0.12.3",
// "org.http4s" %% "http4s-dsl" % "0.12.3",
import org.http4s.MediaType._
import org.http4s.client._
import org.http4s.client.blaze.{defaultClient => client}
import org.http4s.dsl._
import org.http4s.headers._
@evbruno
evbruno / EnableCORSDirectives.scala
Last active August 5, 2016 13:24
Akka-http (spray) directive to allow CORS (Cross-Origin Resource Sharing)
import akka.http.scaladsl.model.HttpMethods._
import akka.http.scaladsl.model.headers.{`Access-Control-Allow-Credentials`, `Access-Control-Allow-Headers`, `Access-Control-Allow-Methods`, `Access-Control-Allow-Origin`}
import akka.http.scaladsl.server.directives.RespondWithDirectives
trait EnableCORSDirectives extends RespondWithDirectives {
private val allowedCorsVerbs = List(
CONNECT, DELETE, GET, HEAD, OPTIONS,
PATCH, POST, PUT, TRACE
)
// participation.cpp
#include<iostream>
using std::cout;
using std::endl;
void nope() {}
void participation() { return nope(); }
int main() {
participation();