提前优化
:plus1:
toml??
真到正式项目,我还是选 Rails
本地还在用 2.1
前端发展好快
#51 楼 @blackanger 期待新书,出了马上买
感觉有点 小题大做
mongodb
可以的,看水平
Elixir 1.0.5 已经支持
大 cookie 是可以搞攻击的,中间人,插入大 cookie
Type-S 不是要 2k
#10 楼 @cassiuschen 两年前用算
#7 楼 @cassiuschen 能用的只能选 Go,放弃就算了
:plus1:
:plus1:
Elixir +1
写脚本或者自动化的运维工具,比较 puppet,ansible
Elixir 用宏实现的模板 dsl
defmodule Html do
defmacro markup(do: block) do
quote do
{:ok, var!(buffer, Html)} = start_buffer([])
unquote(block)
result = render(var!(buffer, Html))
:ok = stop_buffer(var!(buffer, Html))
result
end
end
def start_buffer(state) do
Agent.start_link(fn -> state end)
end
def stop_buffer(buff) do
Agent.stop(buff)
end
def put_buffer(buff, content) do
Agent.update(buff, &[content | &1])
end
def render(buff) do
Agent.get(buff, &(&1)) |> Enum.reverse |> Enum.join(" ")
end
defmacro tag(name, do: block) do
quote do
put_buffer(var!(buffer, Html), "<#{unquote(name)}>")
unquote(block)
put_buffer(var!(buffer, Html), "</#{unquote(name)}>")
end
end
defmacro text(text) do
quote do
put_buffer var!(buffer, Html), to_string(unquote(text))
end
end
end
defmodule Template do
import Html
require Html
def render do
markup do
tag :table do
tag :tr do
for i <- 0..5 do
tag :td, do: text("Cell #{i}")
end
end
end
tag :div do
text "Some Nested Content"
end
end
end
end
elixir
:plus1: :plus1: