Instantly share code, notes, and snippets.

View results.md
$ mix profile.fprof -e "ElixirScript.Compiler.compile(URI)"

                                                                   CNT    ACC (ms)    OWN (ms)
Total                                                          5534687   19554.581   61222.761
:proc_lib.init_p/5                                                 333  194820.867      19.113
:suspend                                                         21496  167338.101       0.000
:proc_lib.init_p_do_apply/3                                        333   93366.534       7.201
:erlang.apply/2                                                    337   87322.239       3.631
Task.Supervised.reply/4                                            332   73806.514       7.144
View client.ex
defmodule ViewService do
defstruct [:locahost, :port]
def init(host, port) do
%ViewService{localhost: localhost, port: port}
end
def render_view(view_service, route, data) do
# ...
View client.ex
defmodule Client do
def render_view(name, data) do
host = Application.get_env(:my_app, :host)
port = Application.get_env(:my_app, :port)
...
end
end
View keybase.md

Keybase proof

I hereby claim:

  • I am bryanjos on github.
  • I am bryanjos (https://keybase.io/bryanjos) on keybase.
  • I have a public key whose fingerprint is F80E F871 562A 7418 6398 F66C 7F13 18D2 0906 5EB0

To claim this, I am signing this object:

View geo.ex
schema "geographies" do
field :name, :string
field :geom, Geo.Point
end
View .ex
defmodule ReactDOM do
@tags [
:a,
:abbr,
:acronym,
:address,
:applet,
:area,
:article,
View errors.sh
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.5
BuildVersion: 14F27
$ erl
Erlang/OTP 18 [erts-7.0.3] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
$ mix
{"init terminating in do_boot",{{badmatch,{error,{elixir,{bad_return,{{elixir,start,[normal,[]]},{'EXIT',{{badmatch,{error,enotsup}},[{elixir,start,2,[{file,"src/elixir.erl"},{line,34}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,273}]}]}}}}}}},[{elixir,start_cli,0,[{file,"src/elixir.erl"},{line,75}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
View geo_time.ex
defmodule Example do
use Ecto.Model
schema "example" do
field :time, Ecto.Datetime
field :geom, Geo.Linestring
end
end
View gist:dec013918914dc0b3090
opts = [hostname: "localhost", username: "postgres", database: "geo_postgrex_test"]
{:ok, pid} = Postgrex.Connection.start_link(opts)
** (EXIT from #PID<0.127.0>) exited in: GenServer.call(Postgrex.TypeServer, {:fetch, {'localhost', 5432, "geo_postgrex_test", []}}, 60000)
** (EXIT) no process
[error] GenServer #PID<0.131.0> terminating
Last message: {:tcp, #Port<0.5421>, <<82, 0, 0, 0, 8, 0, 0, 0, 0, 83, 0, 0, 0, 22, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 95, 110, 97, 109, 101, 0, 0, 83, 0, 0, 0, 25, 99, 108, 105, 101, 110, 116, 95, 101, 110, 99, 111, ...>>}
State: %{backend_key: nil, bootstrap: false, extensions: [{Postgrex.Extensions.Binary, nil}, {Postgrex.Extensions.Text, nil}], listener_channels: #HashDict<[]>, listeners: #HashDict<[]>, opts: [hostname: "localhost", username: "postgres", database: "geo_postgrex_test"], parameters: %{}, portal: nil, queue: {[%{command: {:connect, [hostname: "localhost", username: "postgres", database: "geo_postgrex_test"]}, from: nil, reply: :no
View gist:f2b44b5ca08c82169bd2
defmodule Geo.PostGIS.Functions do
def st_area(geom) do
quote do: fragment("ST_Area(?)", unquote(geom))
end
#Example query
query = from location in Location, limit: 5, select: st_area(location.geom)
results = Repo.all(query)