Skip to content

Instantly share code, notes, and snippets.

View alco's full-sized avatar
🇺🇦

Oleksii Sholik alco

🇺🇦
View GitHub Profile
bo
bmg
bjejg
bdnbbeg
begklgebg
bknjgpgeogg
defp deps do
[{:cowboy, github: "extend/cowboy", tag: "0.9.0"},
{:gproc, github: "esl/gproc"}]
end
root@cc65acb033ba:/home/beamie# ls _build/dev/lib/
beamie_eval cowboy cowlib gproc ranch
root@cc65acb033ba:/home/beamie# mix run
Unchecked dependencies for environment dev:
* gproc (git://github.com/esl/gproc.git)
the dependency is not available, run `mix deps.get`
* cowboy (git://github.com/extend/cowboy.git)
the dependency is not available, run `mix deps.get`
** (Mix) [beamie_eval] Can't continue due to errors on dependencies
root@cc65acb033ba:/home/beamie# ls _build/dev/lib/
21) test yields with no content (WyvernTest.FragmentTest)
test/wyvern/rendering/fragment_test.exs:42
** (CompileError) nofile:1: undefined function content/0
stacktrace:
(elixir) src/elixir_translator.erl:344: :elixir_translator.translate_arg/3
(stdlib) lists.erl:1352: :lists.mapfoldl/3
(elixir) src/elixir_translator.erl:207: :elixir_translator.translate/2
(elixir) src/elixir_translator.erl:344: :elixir_translator.translate_arg/3
(elixir) src/elixir_bitstring.erl:160: :elixir_bitstring.build_bitstr_each/8
(elixir) src/elixir_bitstring.erl:120: :elixir_bitstring.build_bitstr/4
@alco
alco / exercise.exs
Last active August 29, 2015 14:02 — forked from josevalim/exercise.exs
@proto_version "1.0"
def process_options(opts) do
ret = Enum.reduce(opts, [], fn
{:in, _}, ret -> ["-in"|ret]
{:err, :out}, ret -> ["-err", "out"|ret]
{:err, :err}, ret -> ["-err", "err"|ret]
{:dir, dir}, ret -> ["-dir", dir|ret]
_ -> ret
end)
Porcelain.spawn("sort", [], in: IO.stream(:stdio, :line), out: IO.stream(:stdio, :line))
# or
%Porcelain.Process{out: outstream} = Porcelain.spawn("sort", [], in: IO.stream(:stdio, :line), out: :stream)
# read from outstream here
λ erl -pa ebin -s lagg
Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V6.0 (abort with ^G)
1> (<0.41.0>) << {dbg,{ok,[{matched,nonode@nohost,1}]}} (Timestamp: {1403,301453,
757731})
THIS TOOK LONGER THAN YOU EXPECTED
(<0.41.0>) in {dbg,req,1} (Timestamp: {1403,301453,757740})
(<0.41.0>) <0.40.0> ! {io_request,<0.41.0>,<0.40.0>,
{put_chars,unicode,
This module provides 3 main APIs for you to use:
1. Evaluate a string (eval_string) or a file (eval_file) directly. This
is the simplest API to use but also the slowest, since the code is
evaluated and not compiled before.
2. Define a function from a string (function_from_string) or a file
(function_from_file). This allows you to embed the template as a function
inside a module which will then be compiled. This is the preferred API if
you have access to the template at compilation time.
spec = %{
commands: [
%{name: "abc", ...},
%{name: "def", ...},
...
]
}
...
ControlFlow.if false do
IO.puts false
elsif |> "s" |> String.length
IO.puts "false2"
elsif true
IO.puts "true"
end