Skip to content

Instantly share code, notes, and snippets.

View oyeb's full-sized avatar
🎯
Focusing

Ananya Bahadur oyeb

🎯
Focusing
View GitHub Profile
@oyeb
oyeb / monei.iex.exs
Last active April 9, 2018 06:31
Some frequently used bindings for MONEI
# Handy bindings when developing the MONEI gateway integration.
# Most of the bindings are for the `opts`
# Instructions
# Just rename this file to `.iex.exs` and save it in either,
# 1. the gringotts root directory
# 2. your applications root directory
# essentially the place where you launch your `iex` sessions via `iex -S mix`.
@oyeb
oyeb / post-commit
Last active February 12, 2018 10:15
A git-hook that runs credo and optionally the formatter on commited changes
#!/bin/sh
#
# Runs credo and the formatter on the staged files, after the commit is made
# This is purely for notification and will not halt/change your commit.
# You must add the "path to Elixir 1.6 repository" to `ELIXIR_16` environment variable,
# Add this to your shell's `.rc`:
# export ELIXIR_16=path/to/elixir1.6
# List all .ex files staged in the previous commit
@oyeb
oyeb / authorize_net.iex.exs
Last active February 1, 2018 12:17
Some frequently used bindings for AuthorizeNet
# Handy bindings when developing the AuthorizeNet gateway integration.
# Most of the bindings are for the `opts`
# Instructions
# Just rename this file to `.iex.exs` and save it in either,
# 1. the gringotts root directory
# 2. your applications root directory
# essentially the place where you launch your `iex` sessions via `iex -S mix`.
@oyeb
oyeb / trexle.iex.exs
Last active February 1, 2018 12:16
Some frequently used bindings for Trexle development
# Handy bindings when developing the Trexle gateway integration.
# Most of the bindings are for the `opts`
# Instructions
# Just rename this file to `.iex.exs` and save it in either,
# 1. the gringotts root directory
# 2. your applications root directory
# essentially the place where you launch your `iex` sessions via `iex -S mix`.
@oyeb
oyeb / cams.iex.exs
Last active February 1, 2018 12:17
Some frequently used bindings for CAMS
# Handy bindings when developing the CAMS gateway integration.
# Most of the bindings are for the `opts`
# Instructions
# Just rename this file to `.iex.exs` and save it in either,
# 1. the gringotts root directory
# 2. your applications root directory
# essentially the place where you launch your `iex` sessions via `iex -S mix`.
@oyeb
oyeb / global_collect.iex.exs
Created February 1, 2018 11:51
Some frequently used bindings for GlobalCollect
# Handy bindings when developing the GlobalCollect gateway integration.
# Most of the bindings are for the `opts`
# Instructions
# Just rename this file to `.iex.exs` and save it in either,
# 1. the gringotts root directory
# 2. your applications root directory
# essentially the place where you launche your `iex` sessions via `iex -S mix`.
@oyeb
oyeb / pre-commit
Created February 12, 2018 10:11
A pre-commit hook that DRY-runs the elixir formatter
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
@oyeb
oyeb / money_test.exs
Created June 6, 2018 09:50
Tests for ex_money's protocol implementation
alias Gringotts.Money, as: MoneyProtocol
describe "Gringotts.Money protocol implementation" do
# You may not need this one :)
test "currency is an upcase String.t" do
the_currency = MoneyProtocol.currency(Money.new(0, :USD))
assert match?(currency when is_binary(currency), the_currency)
assert the_currency == String.upcase(the_currency)
end
test "to_integer" do
@oyeb
oyeb / sagepay.iex.exs
Created June 6, 2018 17:31
Some handy IEx bindings for the SagePay gateway
alias Gringotts.{CreditCard, Response}
card = %CreditCard{
number: "4929000005559",
month: 3,
year: 20,
first_name: "SAM",
last_name: "JONES",
verification_code: "123",
brand: "VISA"
@oyeb
oyeb / .emacs
Last active August 1, 2019 05:06
Suggested emacs config (without stack)
;; Drop this in your ~/.emacs OR ~/.emacs.d/init.el
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/")
'("org" . "https://orgmode.org/elpa/"))
(package-initialize)
;; Bootstrap `use-package'