Skip to content

Instantly share code, notes, and snippets.

Building @tellerhq

Stevie Graham stevegraham

Building @tellerhq
View GitHub Profile
View migrate.js
document.addEventListener("DOMContentLoaded", function() {
var tellerConnect = TellerConnect.setup({
applicationId: "your_app_id",
skipPicker: true,
onInit: function() {
document.querySelector("button.teller-connect").addEventListener("click", function() {{institution: "chase"})
onSuccess: function(enrollment) {
stevegraham / teller_payments.rb
Created May 8, 2018 14:20
Teller payment example with signatures
View teller_payments.rb
require "net/https"
require "time"
require "base64"
require "uri"
require "securerandom"
# Load your private key
pkey ="private_key.pem")
# Create new HTTP request
stevegraham / payment_example.rb
Created May 8, 2018 14:17
Teller payment example with signature
View payment_example.rb
require "net/https"
require "time"
require "base64"
require "uri"
require "securerandom"
# Load your private key
pkey ="private_key.pem")
# Create new HTTP request
View foo.ex
defmodule Foo do
def bar(%{baz => _}), do: "I wish pattern matching map keys worked"
View signup_form.ex
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
stevegraham / example.ex
Last active August 30, 2015 04:47
Memorex - a cache for expensive code paths
View example.ex
require Memorex
# Cache this expensive function call, e.g. external service API
Memorex.get("unique_cache_key", ttl: 30) do
View gist:a319cc39dfc02fbb8a78

http: [compress: true] is set on App.Endpoint

defmodule App.Router do
  use Phoenix.Router

  scope "/", App do
    resources "foo", FooController do
stevegraham / mockery.ex
Created July 20, 2015 03:26
Mockery example
View mockery.ex
defmodule RequestTest do
use ExUnit.Case, async: false
use Mockery
def dsl_test do
Mockery.intercept do
request = %Request{ method: :post, uri: "", body: "hello=world", headers: %{ "User-Agent" => "My App" } }
response = %Response{ status: 201 }
stub_request request, response
View gist:b4f43cd761973b073882
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 }
stevegraham / fizzbuzz.ex
Created December 20, 2014 14:46
Functional FizzBuzz
View fizzbuzz.ex
defmodule FizzBuzz do
def upto(n) when n > 0, do: 1..n |>
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