Skip to content

Instantly share code, notes, and snippets.

View stevegraham's full-sized avatar
🛠️
Building @tellerhq

Stevie Graham stevegraham

🛠️
Building @tellerhq
View GitHub Profile
@stevegraham
stevegraham / adam.css
Created February 8, 2012 19:13
spotify app stylesheets
/**
* Adam Theme / Dark Theme
* Standard Layout for Spotify Client
* Defines the basic styles for an app
* @copyright 2011 by Spotify
*/
/**
* Declarations for Adam Theme
*
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) {
@stevegraham
stevegraham / teller_payments.rb
Created May 8, 2018 14:20
Teller payment example with signatures
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
@stevegraham
stevegraham / payment_example.rb
Created May 8, 2018 14:17
Teller payment example with signature
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
@stevegraham
stevegraham / 1.rb
Created September 20, 2012 00:25
Symbol#to_proc
%w(john paul ringo george).map { |p| p.capitalize }
# => ["John", "Paul", "Ringo", "George"]
@stevegraham
stevegraham / active_jerbz.rake
Created December 4, 2014 15:47
Run ActiveJobs with Sneakers
require 'sneakers/runner'
task :environment
namespace :sneakers do
desc "Start processing jobs with all workers"
task :work => :environment do
silence_warnings do
Rails.application.eager_load! unless Rails.application.config.eager_load
end
@stevegraham
stevegraham / description.js
Last active December 30, 2015 10:28
Restafarian "code-on-demand" example used to inform client what a valid resource is, including non-authorative property validations.
Function.prototype.curry = function() {
var fn = this;
var slice = Array.prototype.slice;
var args = slice.call(arguments);
return function() {
return fn.apply(this, args.concat(slice.call(arguments)));
}
}
// Cannot init an NSManagedObject. Have to insert into an NSManagedObjectContext instance.
NSManagedObjectSubclass * scratchObj = [NSEntityDescription insertNewObjectForEntityForName:@"Foo"
inManagedObjectContext:AppDelegate.managedObjectContext];
// Set the properties on our object, e.g. via UITextField IBOutlets
scratchObj.foo = @"foo";
// Post the object. Assume use of an RKMapping here.
[[RKObjectManager sharedManager] postObject:scratchObj path:nil parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
//
// NSString+Inflections.m
// Zap
//
// Created by Stevie Graham on 28/10/2013.
//
#import "NSString+Inflections.h"
@implementation NSString (Inflections)