Skip to content

Instantly share code, notes, and snippets.

View thebrianemory's full-sized avatar

Brian Emory thebrianemory

View GitHub Profile
[%{categories: ["programming", "coding", "elixir", "web-development"],
content: "I was tasked with a code challenge to create an Elixir/Phoenix app that would be a newsletter sending system. The requirements were simple and I had 48 hours to complete it. I lost a bit of time on the first day which caused me to cut some corners and not use TDD (tsk tsk). I had a deadline and...",
date: "Aug 11, 2017",
link: ["https://medium.brianemory.com/a-newsletter-sending-system-code-challenge-22da00d073cc"],
subheading: "Completing it taught me a lot",
title: "A Newsletter Sending System Code Challenge"},
%{categories: ["learning", "elixir", "programming", "goals", "web-development"],
content: "I have been learning Elixir the last few months and I am really enjoying it. So much in fact, I am making that my main focus. This includes what I spend my time learning and programming, and where I apply to for jobs. Elixir 1.5 and Phoenix 1.3 just came out so it is a good time to buckle down and...",
date: "Aug 02,
use Mix.Config
... # Code removed for readability
### Add that code below this line ###
# Configure Google OAuth
config :ueberauth, Ueberauth,
providers: [
google: {Ueberauth.Strategy.Google, [default_scope: "email profile plus.me"]}
<div class="hero-section">
<div class="hero-section-text">
<h1>Welcome to Catcasts!</h1>
</div>
</div>
defmodule CatcastsWeb.AuthControllerTest do
use CatcastsWeb.ConnCase
alias Catcasts.Repo # add this line
alias Catcasts.User # add this line
@ueberauth_auth %{credentials: %{token: "fdsnoafhnoofh08h38h"},
info: %{email: "batman@example.com", first_name: "Bruce", last_name: "Wayne"},
provider: :google}
... # Code removed for readability
defmodule Catcasts.Repo.Migrations.AddTokenToUsers do
use Ecto.Migration
def change do
alter table("users") do
add(:token, :string)
end
end
end
[
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
defmodule CatcastsWeb.VideoController do
use CatcastsWeb, :controller
use Rummage.Phoenix.Controller
... # Code removed for readability
end
defmodule CatcastsWeb.VideoView do
use CatcastsWeb, :view
use Rummage.Phoenix.View
end
defmodule CatcastsWeb.VideoController do
use CatcastsWeb, :controller
alias Catcasts.Videos
alias Catcasts.Videos.{Video, YoutubeData}
plug :check_video_owner when action in [:delete]
... # Code removed for readability
describe "new video" do
test "renders form", %{conn: conn} do
user = insert(:user)
conn = conn
|> assign(:user, user)
|> get(video_path(conn, :new))
assert html_response(conn, 200) =~ "Add video"
end