http: [compress: true]
is set on App.Endpoint
defmodule App.Router do
use Phoenix.Router
scope "/", App do
resources "foo", FooController do
end
end
document.addEventListener("DOMContentLoaded", function() { | |
var tellerConnect = TellerConnect.setup({ | |
applicationId: "your_app_id", | |
skipPicker: true, | |
onInit: function() { | |
document.querySelector("button.teller-connect").addEventListener("click", function() { | |
tellerConnect.open({institution: "chase"}) | |
}) | |
}, | |
onSuccess: function(enrollment) { |
require "net/https" | |
require "time" | |
require "base64" | |
require "uri" | |
require "securerandom" | |
# Load your private key | |
pkey = OpenSSL::PKey::RSA.new File.read("private_key.pem") | |
# Create new HTTP request |
require "net/https" | |
require "time" | |
require "base64" | |
require "uri" | |
require "securerandom" | |
# Load your private key | |
pkey = OpenSSL::PKey::RSA.new File.read("private_key.pem") | |
# Create new HTTP request |
defmodule Foo do | |
def bar(%{baz => _}), do: "I wish pattern matching map keys worked" | |
end |
defmodule Teller.Web.SignupForm do | |
use Form, | |
email: :email, | |
password: :password, | |
password_confirmation: :password | |
validates :email, presence: true | |
validates :password, length: [min: 8], confirmation: true | |
end |
require Memorex | |
Memorex.start_link([]) | |
# Cache this expensive function call, e.g. external service API | |
Memorex.get("unique_cache_key", ttl: 30) do | |
do_some_expensive_shit | |
end | |
http: [compress: true]
is set on App.Endpoint
defmodule App.Router do
use Phoenix.Router
scope "/", App do
resources "foo", FooController do
end
end
defmodule RequestTest do | |
use ExUnit.Case, async: false | |
use Mockery | |
def dsl_test do | |
Mockery.intercept do | |
request = %Request{ method: :post, uri: "http://example.com:3000/users", body: "hello=world", headers: %{ "User-Agent" => "My App" } } | |
response = %Response{ status: 201 } | |
stub_request request, response |
defmodule Knox.Ecto.Hstore do | |
@behaviour Ecto.Type | |
def type, do: :hstore | |
def blank?, do: false | |
def load(t), do: { :ok, t } | |
def dump(t), do: { :ok, t } | |
def cast(t), do: { :ok, t } | |
end |
defmodule FizzBuzz do | |
def upto(n) when n > 0, do: 1..n |> Enum.map(&fizzbuzz/1) | |
defp fizzbuzz(n) when rem(n, 15) == 0, do: "FizzBuzz" | |
defp fizzbuzz(n) when rem(n, 3) == 0, do: "Fizz" | |
defp fizzbuzz(n) when rem(n, 5) == 0, do: "Buzz" | |
defp fizzbuzz(n), do: n | |
end |