Skip to content

Instantly share code, notes, and snippets.

View dgoldie's full-sized avatar

Doug Goldie dgoldie

  • Mountain View, CA
View GitHub Profile
@dgoldie
dgoldie / gist:c7227a05cd8f9ce739a3
Last active August 29, 2015 14:03
second view
(Phoenix.Template.UndefinedError) No such template "start.html"
Stacktrace
(thor) lib/thor/views/pages.ex:1: Thor.Views.Pages.render/2
(phoenix) lib/phoenix/controller.ex:132: Phoenix.Controller.render_view/5
(thor) lib/thor/router.ex:1: anonymous fn/1 in Thor.Router.call/2
(phoenix) lib/phoenix/plugs/error_handler.ex:9: Phoenix.Plugs.ErrorHandler.wrap/3
(plug) lib/plug/adapters/cowboy/handler.ex:7: Plug.Adapters.Cowboy.Handler.init/3
(cowboy) src/cowboy_handler.erl:64: :cowboy_handler.handler_init/4
@dgoldie
dgoldie / match.exs
Created July 23, 2014 07:33 — forked from alco/match.exs
import M
File.read("match.exs") |> match({:ok, bin}, bin) |> String.length
#=> 156
s = """
id;name;value
1;foo;hi
2;bar;bye
"""
@dgoldie
dgoldie / create_dweet.exs
Created July 29, 2014 20:02
Ecto first try
defmodule EctoTest.Repo.Migrations.CreateDweet do
use Ecto.Migration
def up do
"CREATE TABLE dweets(id serial primary key, content varchar(140), author varchar(50))"
end
def down do
"DROP TABLE dweets"
end
@dgoldie
dgoldie / Upgrade_phoenix4.md
Created August 6, 2014 22:27
Upgrade to Phoenix 4

README - upgrade to phoenix 4.

This conversion was actually done with phoenix master, the week before phoenix 4 released.

Using:

  • Erlang 17.0
  • Elixir 0.15.0
  • Phoenix master, "55577a267a1635af3d19fb5c37381077bd25e484"

Steps:

@dgoldie
dgoldie / consumer_agent.ex
Last active August 29, 2015 14:05
rate limit resource problem
defmodule Connection.Yahoo.ConsumerAgent do
require Logger
@name {:global, YahooConsumerAgent }
def name do
@name
end
@doc """
@dgoldie
dgoldie / mix.exs
Created August 31, 2014 17:41
upgrade phoenix
defmodule Thor.Mixfile do
use Mix.Project
def project do
[ app: :thor,
version: "0.0.1",
elixir: "0.15.1",
elixirc_paths: ["lib", "web"],
deps: deps ]
end
@dgoldie
dgoldie / experiments.exs
Created September 1, 2014 22:27
Experiments with Elixir strings
defmodule Exp do
def cat_consonants(list), do: cat_consonants(list, [])
def cat_consonants([one, two | tail], acc) do
combo = one <> two
case has_vowel?(combo) do
true ->
new_head = [two | tail]
@dgoldie
dgoldie / gist:d632527d4062eee341fc
Created September 12, 2014 20:05
Phoenix html safe error
[error] ErlangError) erlang error: {:error, :function_clause}
(phoenix) lib/phoenix/html.ex:71: Phoenix.Html.Safe.Tuple.to_string({:safe, [91, [123, [[34, ["name"], 34], 58, [34, ["Eddie"], 34], 44, [34, ["id"], 34], 58, "18", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["8 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '81.06', 44, [34, ["contests"], 34], 58, "null"], 125], [44, [123, [[34, ["name"], 34], 58, [34, ["Leslie"], 34], 44, [34, ["id"], 34], 58, "16", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["4 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '78.33', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["Denny"], 34], 44, [34, ["id"], 34], 58, "17", 44, [34, ["fantasy_iq_description"], 34], 58, [34, ["10 Yahoo Seasons"], 34], 44, [34, ["fantasy_iq"], 34], 58, '77.65', 44, [34, ["contests"], 34], 58, "null"], 125], 44, [123, [[34, ["name"], 34], 58, [34, ["Johnny"], 34], 44, [34, ["id"], 34], 58, "15", 44, [34, ["fantasy_iq_de
@dgoldie
dgoldie / login_session_with_tucotuco
Last active August 29, 2015 14:08
Using TucoTuco with login form
Interactive Elixir (1.0.1-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> use TucoTuco.DSL
:ok
iex(2)> TucoTuco.start_session :test_browser, :tuco_test, :phantomjs
{:ok,
%TucoTuco.SessionPool.SessionPoolState{app_root: nil,
current_session: :tuco_test, max_retry_time: 2000, retry_delay: 50,
use_retry: false}}
iex(3)> visit "http://games.espn.go.com/ffl/signin"
{:ok,
@dgoldie
dgoldie / configure.log
Last active August 29, 2015 14:08
installing nokogiri on Yosemite
2.1.4 apollo:~
$ cat /Users/doug/.rvm/gems/ruby-2.1.4/gems/nokogiri-1.6.3.1/ext/nokogiri/tmp/x86_64-apple-darwin14.0.0/ports/libxml2/2.8.0/configure.log
configure: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used
configure: error: cannot find sources (entities.c) in /Users/doug/code/libraries/ctags or ..
2.1.4 apollo:~