Skip to content

Instantly share code, notes, and snippets.

View ccabanero's full-sized avatar

Clint Cabanero ccabanero

View GitHub Profile
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of a UILabel
Last active March 9, 2021 15:08
Sample iOS Unit Tests: Working with a ViewController composed of a UILabel
import XCTest
@testable import UnitTests
class ExampleTests: XCTestCase {
var viewControllerUnderTest: ViewController!
override func setUp() {
super.setUp()
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of MKMapView
Last active February 8, 2021 08:46
Sample iOS Unit Tests: Working with a ViewController composed of MKMapView
import UIKit
import XCTest
import MapKit
class ExampleTests: XCTestCase {
//declaring the ViewController under test as an implicitly unwrapped optional
var viewControllerUnderTest : ViewController!
override func setUp() {
@ccabanero
ccabanero / TileStream - Notes for deploying TileStream on an AWS EC2 Ubuntu 12.04.2 Server
Last active December 4, 2020 10:15
TileStream - Notes for deploying TileStream on an AWS EC2 Ubuntu 12.04.2 Server
------------------------------------------------------------------------------------------------------------------------------
DESCRIPTION:
Notes for deploying TileStream on an AWS EC2 Ubuntu 12.04.2 Server for development. Includes workflow for creating
a local tile cache with TileMill, connecting to your Ubuntu EC2 server via SSH using Mac OSX Terminal, and uploading
your tiles (.mbtiles) to your TileStream server.
REFERENCES:
TileStream git repo: https://github.com/mapbox/tilestream
-----------------------------------------------------------------------------------------------------------------------------
@ccabanero
ccabanero / Sample iOS Unit Tests: Testing Segue passes data to Target ViewController
Last active April 15, 2020 10:39
Sample iOS Unit Tests: Testing Segue passes data to Target ViewController
func testSUT_PassesDataToTargetViewController() {
// declare the storyboard, source view controller, and target view controller
let storyboard: UIStoryboard = UIStoryboard(name: "Main_iPhone", bundle: nil)
let callingViewController = storyboard.instantiateViewControllerWithIdentifier("PlaceListViewController") as! PlaceListViewController
let targetViewController = storyboard.instantiateViewControllerWithIdentifier("PlaceDetailsViewController") as! PlaceDetailsViewController
// fetch the segue from story board
let targetSegue: UIStoryboardSegue = UIStoryboardSegue(identifier: callingViewController.placeDetailsViewControllerSegue, source: callingViewController, destination: targetViewController)
@ccabanero
ccabanero / Sample iOS Unit Tests: Testing Model Class Initialization
Last active March 9, 2020 15:15
Sample iOS Unit Tests: Testing Model Class Initialization
// example of unit test for model initialization
// TEST CODE
import XCTest
@testable import yourmodule
class PlaceTest: XCTestCase {
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of UISearchBar
Last active January 24, 2020 20:29
Sample iOS Unit Tests: Working with a ViewController composed of UISearchBar
import XCTest
@testable import YourProjectModule
class ViewControllerTest: XCTestCase {
var systemUnderTest: ViewController!
override func setUp() {
super.setUp()
@ccabanero
ccabanero / AWS - S3 Public Bucket Policy
Last active September 10, 2019 06:39
AWS - S3 Public Bucket Policy
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
@ccabanero
ccabanero / AWS CLI Cheat Sheet
Last active July 4, 2019 20:56
AWS CLI Cheat Sheet
See Profiles Configured on Machine:
$ vim ~/.aws/config
$ vim ~/.aws/credentials
Create profile
$ aws configure --profile YourProfileName1
$ aws configure --profile YourProfileName2
@ccabanero
ccabanero / Sample iOS Integration Test: Test When Model performs work over the Network
Last active June 10, 2019 22:06
Sample iOS Integration Test: Test When Model performs work over the Network
// Example of an asynchronous unit test
func testUserLogin() {
let readyExpectation = expectationWithDescription("ready")
User.loginWithUsername("kris@bla.org", password: "blah") { (isSuccess) -> Void in
let expectedLoginSuccessStatus = true
@ccabanero
ccabanero / Sample iOS Unit Tests: Testing Model Class methods
Last active June 10, 2019 22:06
Sample iOS Unit Tests: Testing Model Class methods
//
// TEST CODE
import XCTest
@testable import to
class JSONReaderTest: XCTestCase {