Skip to content

Instantly share code, notes, and snippets.

View alexpaul's full-sized avatar
:octocat:

Alex Paul alexpaul

:octocat:
View GitHub Profile
body {
background-color: powderblue;
}
h1 {
color: blue;
}
p {
color: red;
}
//: Playground - noun: a place where people can play
import UIKit
let string = """
{"name" : "alice"}
{"name" : "bob"}
{"name" : "jane"}
"""
//
// ImageCache.swift
// CatOrDog
//
// Created by Alex Paul on 12/19/17.
// Copyright © 2017 Alex Paul. All rights reserved.
//
// This is a singleton to manage our NSCache objects
// NSCache saves temporary files in the caches directory ]
@alexpaul
alexpaul / FullScreenImageView.swift
Created May 22, 2018 01:10
A UIScrollView with an UIImageView that enables zooming.
import UIKit
import Kingfisher
class FullScreenImageView: UIView {
@IBOutlet var contentView: UIView!
@IBOutlet var dismissButton: UIButton!
@IBOutlet var shareButton: UIButton!
@IBOutlet var imageView: UIImageView!
@IBOutlet var scrollView: UIScrollView!
@alexpaul
alexpaul / ParsingJSONTests.m
Created May 22, 2018 01:15
Parsing JSON in Objective-C
#import <XCTest/XCTest.h>
#import "Person.h"
@interface ParsingJSONTests : XCTestCase
@end
@implementation ParsingJSONTests
- (void)testReadingJSONFile {
#pragma mark Keyboard Handling
- (void)registerForKeyboardNotifications {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
- (void)keyboardWillShow: (NSNotification *)notification {
NSDictionary *userInfo = [notification userInfo];
CGSize size = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
import UIKit
import Fakery
class ViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
private var companies = [String]()
private var panGesture: UIPanGestureRecognizer!
@alexpaul
alexpaul / NetworkHelper.h
Created May 25, 2018 10:57
This NetworkHelper is a wrapper that uses NSURLSession to make HTTP requests on behalf of an API network call.
//
// NetworkHelper.h
// Events
//
// Created by Alex Paul on 5/23/18.
// Copyright © 2018 Alex Paul. All rights reserved.
//
@interface NetworkHelper: NSObject
@alexpaul
alexpaul / ImageCache.h
Last active May 26, 2018 22:16
Uses NSCache to temporarily store images using key/value.
//
// ImageCache.h
// Events
//
// Created by Alex Paul on 5/24/18.
// Copyright © 2018 Alex Paul. All rights reserved.
//
#import <UIKit/UIKit.h>
@alexpaul
alexpaul / PersistenceDataTests.m
Last active May 26, 2018 22:17
Unit tests to verify archiving and unarchiving from the documents directory. NSKeyedArchiver and NSKeyedUnarchiver are used for Persistence.
//
// PersistenceDataTests.m
// EventsTests
//
// Created by Alex Paul on 5/24/18.
// Copyright © 2018 Alex Paul. All rights reserved.
//
#import <XCTest/XCTest.h>
#import "Event.h"