Skip to content

Instantly share code, notes, and snippets.

@arinhouck
arinhouck / TableView Image Placeholder
Created November 18, 2015 04:20
Table view image placeholder for when waiting on API to load, makes it look like table is filled with "grey text boxes"
Set on viewDidLoad()
self.tableView.backgroundColor = UIColor(patternImage: UIImage(named: "empty-cell.png")!)
Where ever you call your table reload after API call add this line:
self.tableView.backgroundColor = UIColor.whiteColor()
Here is the empty cell image used as a background pattern I made:
http://s3.postimg.org/895ohr0c3/empty_cell.png
@arinhouck
arinhouck / stellar.rb
Created March 6, 2018 04:11
Basic Stellar SDK
class Stellar
include HTTParty
base_uri ENV.fetch('STELLAR_BASE_URI', 'https://horizon-testnet.stellar.org')
attr_accessor :cursor
def initialize(account_id, cursor)
# account public key
@account_id = account_id
@arinhouck
arinhouck / payment_processor.rb
Created March 6, 2018 04:13
Basic Stellar Payment Processor
require "#{Rails.root}/lib/sdk/stellar"
class PaymentProcessor
def self.perform
# Create or find a setting record by `cursor` key
cursor_setting = Setting.find_or_create_by(key: 'cursor')
# Extract the value of the `cursor` if it exists in DB
cursor = cursor_setting&.value