Skip to content

Instantly share code, notes, and snippets.

View asowers1's full-sized avatar

Andrew Sowers asowers1

  • Gannett
  • Elmira, New York
View GitHub Profile
@asowers1
asowers1 / billingTest.swift
Created November 2, 2017 16:57
Explores the effectiveness of NotificationMessages and their corresponding payment fulfillment dates
/*
At ----, we aim to find the best messaging that will motivate the patient to engage with us.
You have two lists of data:
A list of bill notification messages sent to patients.
Each message has the following properties: patient_id, channel_type, timestamp
channel_type can be "text", "email", "paper mail", or another channels for contacting patients.
A list of payments that ---- received from patients.
Each message has the following properties: patient_id, payment_amount, timestamp
//: Playground - noun: a place where people can play
import UIKit
var str1 = "Hello, playground 💩"
var str2 = "Hello, playground"
func validate(ascii string: String?) -> Bool {
if let str = string where str.characters.count > 0 {
for char in str.characters {
@asowers1
asowers1 / NSObject+NSCoding.swift
Last active August 9, 2017 17:11
Adding Automatic NSCoding for NSObject in Swift
//
// NSObject+NSCoding.swift
//
// Created by Andrew Sowers on 6/8/16.
//
//
import Foundation
public extension NSObject {
@asowers1
asowers1 / playground.swift
Last active May 5, 2016 18:15
Use Completion Handlers in Xcode playgrounds
//: Playground - noun: a place where people can play
import UIKit
import XCPlayground // we import this so we can get the main XCPlayground "page"
//create instance of current playground page
let page = XCPlayground.XCPlaygroundPage
func myCoolFunctionWithCompletion(input: String, completion: (result: String) -> Void) {
print("\(input) ... ")
@asowers1
asowers1 / MainViewController.swift
Last active October 24, 2018 22:35
Lazy Loading view controllers in Swift
/**
* Lazy load view controller example
*/
class MainViewController: UIViewController {
lazy var firstViewController: FirstViewController = {
return self.storyboard!.instantiateViewControllerWithIdentifier("FirstViewController") as! FirstViewController
}()
lazy var secondViewController: SecondViewController = {