Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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:

@bryanjos
bryanjos / geo.ex
Created November 12, 2015 17:22
Geo Schema
schema "geographies" do
field :name, :string
field :geom, Geo.Point
end
@bryanjos
bryanjos / .ex
Created October 6, 2015 21:33
React Macro
defmodule ReactDOM do
@tags [
:a,
:abbr,
:acronym,
:address,
:applet,
:area,
:article,
@bryanjos
bryanjos / errors.sh
Last active September 8, 2015 16:24
Elixir 1.1-beta errors
$ 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,[]}]}}
defmodule Example do
use Ecto.Model
schema "example" do
field :time, Ecto.Datetime
field :geom, Geo.Linestring
end
end
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
@bryanjos
bryanjos / gist:f2b44b5ca08c82169bd2
Last active August 29, 2015 14:17
postgis function macros
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)
@bryanjos
bryanjos / keybase.md
Created April 21, 2014 15:42
Keybase

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 B649 8B70 07D6 7654 7936 FB1C 8041 19F7 321D 4B75

To claim this, I am signing this object:

//GET http://www.digitaltipjar.com/api/search/:artist_search_string
{
"artists": [
{
"qrcode_url": "http://www.digitaltipjar.com/lays/qrcode",
"tip_url": "http://www.digitaltipjar.com/lays",
"name": "Lays Potato Chips"
}
]