Goal: Get some hands on time playing with Elixir and OTP.
Covers:
- mix
defmodule Authenticate do | |
import Plug.Conn | |
def call(conn, _opts) do | |
case get_req_header(conn, "authorization") do | |
["Bearer " <> token] -> authenticate(conn, token) | |
_ -> reject(conn, "Bearer token missing") | |
end | |
end |
defmodule JaSerializer do | |
end |
Serialization has been moved to the JaSerializer library with the intent of improving the routing/resource DSL to provide more out of the box functionality.
(defn modfive [number] | |
(= 0 (mod number 5))) | |
(defn modthree [number] | |
(= 0 (mod number 3))) | |
(defn foosball [number] | |
(if (modthree number) | |
(if (modfive number) "foosball" "foos") | |
(if (modfive number) "ball" number))) |
(let [env-attributes {:rabbit {:host "blah"}} | |
role-attributes {:rabbit {:host "blah2"}} | |
node-attributes {:rabbit {:host "blah3"}}] | |
(merge env-attributes role-attributes node-attributes)) |
#!/bin/sh | |
# Use: Generate rails app from template in rvm gemset named after app. | |
# wget https://raw.github.com/gist/3902844/railst | |
# chmod +x railst | |
# ./railst appname | |
rvm use 1.9.3 | |
rvm gemset create $1 | |
rvm gemset use $1 |
=INFO REPORT==== 16-Feb-2013::23:23:18 === | |
application: pascal | |
exited: {bad_return, | |
{{'Elixir-Pascal',start,[normal,[]]}, | |
{'EXIT', | |
{undef, | |
[{cowboy_router,compile, | |
[[{'_',[{<<"/">>,'Elixir-Pascal-Handler',[]}]}]], | |
[]}, | |
{'Elixir-Pascal',start,2, |