This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>New Shop</h2> | |
<%= render "signup_form.html", Map.put(assigns, :action, shop_path(@conn, :signup)) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var preferedShipping = "EMS"; // This has to be the exact name of the shipping method you want to be preselected | |
function waitForFetch(tries, callback) { | |
if (tries > 40000) {return} // stop waiting after ~ 40 seconds | |
if (document.querySelector(".blank-slate")) { | |
setTimeout(function() { waitForFetch(tries + 1, callback) }, 10); | |
} else { | |
callback(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Useless.Mixfile do | |
# ... | |
# Specifies your project dependencies. | |
# | |
# Type `mix help deps` for examples and options. | |
defp deps do | |
[ | |
{:phoenix, "~> 1.3.0"}, | |
{:phoenix_pubsub, "~> 1.0"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Without EctoDripper | |
defmodule QueryModule do | |
def query_status(query, args) | |
def query_status(query, %{username: username}) do | |
# Create query when username key is in args | |
# Since we have the key already in the function name, | |
# I find this quite pointless in terms of readability | |
from( | |
thing in query, | |
where: thing.username == ^username |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule DripperExample.AccountUsers do | |
alias DripperExample.{ | |
Repo, | |
Accounts, | |
UserQuery | |
} | |
def find_user(args) do | |
Accounts.User | |
|> UserQuery.query_username(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule DripperExample.FindUserTest do | |
use DripperExample.DataCase | |
alias DripperExample.{ | |
Accounts, | |
AccountUsers | |
} | |
describe "find_user/1" do | |
test "finds a user for given username" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule DripperExample.AccountUsers do | |
alias DripperExample.{ | |
Repo, | |
Accounts, | |
UserQuery | |
} | |
def find_user(args) do | |
Accounts.User | |
|> UserQuery.query_username(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule DripperExample.FindUserTest do | |
use DripperExample.DataCase | |
alias DripperExample.{ | |
Accounts, | |
AccountUsers | |
} | |
describe "find_user/1" do | |
test "finds a user for given username" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "credentials" do | |
alias DripperExample.Accounts.Credential | |
@valid_attrs %{email: "some email"} | |
@update_attrs %{email: "some updated email"} | |
@invalid_attrs %{email: nil} | |
def build_valid_attrs(attrs \\ %{}) do | |
{:ok, user} = Accounts.create_user(%{name: "some name", username: "some username"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule DripperExample.Accounts.Credential do | |
use Ecto.Schema | |
import Ecto.Changeset | |
alias DripperExample.Accounts | |
schema "credentials" do | |
field :email, :string | |
belongs_to :user, Accounts.User | |
timestamps() |
NewerOlder