Skip to content

Instantly share code, notes, and snippets.

View akiradeveloper's full-sized avatar

Akira Hayakawa akiradeveloper

View GitHub Profile
@vkostyukov
vkostyukov / HelloWorld.scala
Created November 11, 2015 13:30
HelloWorld
import com.twitter.finagle.Http
import com.twitter.util.{Future, Await}
import io.finch._
object Test1 extends App {
implicit val encodeMap: EncodeResponse[Map[String, String]] =
EncodeResponse("text/plain")(map =>
Buf.Utf8(map.toSeq.map(kv => kv._1 + ":" + kv._2).mkString("\n"))
)
import com.twitter.finagle.Http
import com.twitter.util.Await
import io.finch._
import io.finch.response.EncodeResponse.encodeString
import io.finch.circe._
object Main {
val hello: Endpoint[String] =
get("hello") {
@voluntas
voluntas / yunagido.rst
Last active December 24, 2018 07:43
夕凪堂コトハジメ
@CMCDragonkai
CMCDragonkai / curry.exs
Last active August 29, 2015 14:16 — forked from patrickgombert/gist:4737bb75d3983d2c6512
Elixir: Currying Macro 2
defmodule Curried do
defmacro defc({name, _, args}, [do: body]) do
curried_args = Enum.map(Enum.with_index(args), fn({_, index}) ->
Enum.take(args, index + 1)
end)
for a <- curried_args do
if a == Enum.at(curried_args, Enum.count(curried_args) - 1) do
quote do
def unquote(name)(unquote_splicing(a)) do
unquote(body)
BracketExpr(Sym(typeDesc), Sym(test_obj))
ObjectTy(Empty(), RecList(Sym(x), Sym(y), Sym(z), Sym(a)))
x:int
y:float
z:string
a:array[range[0, 4], int]
BracketExpr(Sym(typeDesc), BracketExpr(Sym(array), BracketExpr(Sym(range), IntLi
t(0), IntLit(4)), Sym(int)))
@tfrisk-old
tfrisk-old / gist:11286970
Created April 25, 2014 11:52
Install Erlang and Elixir on Debian Wheezy (7.4)
#!/bin/sh
# Debian has older Erlang package (R15) in official repositories, Elixir requires newer (R17)
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get install -y erlang
rm erlang-solutions_1.0_all.deb
# compile Elixir from source