Skip to content
View authenticated.ex
defmodule SogApi.Authenticator do
import Plug.Conn
def attempt_to_authenticate(conn, _) do
case find_account(conn) do
{ :ok, account } ->
assign(conn, :account, account)
:error ->
conn
|> send_resp(401, "")
View deserializer.ex
defmodule SogApi.Deserialize do
def init(options) do
options
end
def call(%Plug.Conn{params: %{"format" => "json-api"}, method: "POST"}=conn, _opts) do
result = _deserialize(conn)
end
def call(%Plug.Conn{params: %{"format" => "json-api"}, method: "PUT"}=conn, _opts) do
View serializer.ex
defmodule SogApi.AccountSerializer do
use JaSerializer
serialize "account" do
attributes [
:first_name,
:last_name,
:email,
:date_of_birth,
:gender,
View gist:df6f55af54d59c47b3f6
** (Protocol.UndefinedError) protocol Access not implemented for SogApi.Account, only the nil atom is supported
(elixir) lib/access.ex:145: Access.Atom.undefined/1
lib/ja_serializer/builder/included.ex:11: anonymous fn/1 in JaSerializer.Builder.Included.build/1
(elixir) lib/enum.ex:662: anonymous fn/3 in Enum.filter/2
(elixir) lib/enum.ex:1261: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:662: Enum.filter/2
lib/ja_serializer/builder/included.ex:11: anonymous fn/2 in JaSerializer.Builder.Included.build/1
(elixir) lib/enum.ex:793: anonymous fn/3 in Enum.flat_map/2
(elixir) lib/enum.ex:1261: Enum."-reduce/3-lists^foldl/2-0-"/3
View node-server.js
setInterval(function() {
var time = Date.now();
arduinos.forEach(function(arduino) {
// each "arduino" is an instance of an Arduino
// class that has a websocket connected to the
// actual corresponding Arduino hardware
arduino.send({currentTime: time});
});
}, 1000);
View output
➜ ecto git:(bc-rename-column) ✗ MIX_ENV=mysql iex -S mix test integration_test/sql/migration.exs:261
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Including tags: [line: "261"]
Excluding tags: [:test]
Request to pry #PID<0.233.0> at lib/ecto/adapters/mysql/connection.ex:28. Allow? [Yn] y
Interactive Elixir (1.0.5) - press Ctrl+C to exit (type h() ENTER for help)
pry(1)>
09:26:48.673 [error] GenServer #PID<0.113.0> terminating
View mysql.ex.result
1) test rename column (Ecto.Integration.MigrationTest)
integration_test/sql/migration.exs:260
** (Mariaex.Error) (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @rename_stmt = concat('ALTER TABLE `rename_col_migration` CHANGE COLUMN `to_' at line 2
stacktrace:
(ecto) lib/ecto/adapters/sql.ex:222: Ecto.Adapters.SQL.query/5
(ecto) lib/ecto/adapters/mysql.ex:91: Ecto.Adapters.MySQL.execute_ddl/3
integration_test/sql/migration.exs:127: Ecto.Integration.MigrationTest.RenameColumnMigration.up/0
(stdlib) timer.erl:194: :timer.tc/3
(ecto) lib/ecto/migration/runner.ex:22: Ecto.Migration.Runner.run/6
(ecto) lib/ecto/migrator.ex:113: Ecto.Migrator.attempt/6
View medford.sucks.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org" />
<meta http-equiv="refresh" content=
"0;url=http://searchassist.verizon.com/main?ParticipantID=euekiz39ksg8nwp7iqj2fp5wzfwi5q76&amp;FailedURI=http%3A%2F%2Fmedford.sucks%2F&amp;FailureMode=1&amp;Implementation=&amp;AddInType=4&amp;Version=pywr1.0&amp;ClientLocation=us" />
View gist:106e158c2a7aaa6f65f8
#Ecto.Query<from e in SogApi.Event,
where: fragment("extract(month from ?) = ?", e.start_time, type(^"1", :integer)),
where: fragment("extract(year from ?) = ?", e.start_time, type(^"2015", :integer))>
{"SELECT e0.\"id\", e0.\"title\", e0.\"description\", e0.\"slug\", e0.\"price\", e0.\"total_spots\", e0.\"start_time\", e0.\"end_time\", e0.\"track\", e0.\"status\", e0.\"banner_image\", e0.\"overview\", e0.\"come_prepared\", e0.\"takeaways\", e0.\"teachers\", e0.\"guest
s\", e0.\"inserted_at\", e0.\"updated_at\", e0.\"location_id\", e0.\"category_id\" FROM \"events\" AS e0 WHERE (extract(month from e0.\"start_time\") = $1::integer) AND (extract(year from e0.\"start_time\") = $1::integer)",
[1, 2015]}
Something went wrong with that request. Please try again.