Skip to content

Instantly share code, notes, and snippets.

//# api/policies/authenticated.js
var jwt = require('jwt-simple');
var moment = require('moment');
// move this to global config
var secret = 'xStmbyc066BOFn40gIr29y09Ud94z1P7';
module.exports = function (req, res, next) {
// currently just using url query for testing
@swelham
swelham / cashier_example.exs
Created February 6, 2017 10:17
Cashier bad request example
defmodule CashierExample do
alias Cashier.Address
alias Cashier.PaymentCard
def purchase do
address = %Address{
line1: "123",
line2: "Main",
city: "New York",
state: "New York",
@swelham
swelham / install.sh
Created April 20, 2017 10:32
Install Elixir on c9.io
sudo touch /etc/init.d/couchdb
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get -y install elixir erlang-dev
rm erlang-solutions_1.0_all.deb
@swelham
swelham / flush-redis-keys.sh
Last active August 2, 2017 09:13
Flush redis keys containing value
redis-cli EVAL "for i, name in ipairs(redis.call('KEYS', '*SOME_VALUE*')) do redis.call('DEL', name); end" 0