Skip to content

Instantly share code, notes, and snippets.

View ccabanero's full-sized avatar

Clint Cabanero ccabanero

View GitHub Profile
@ccabanero
ccabanero / Count lines of code in Xcode project
Created August 9, 2014 12:14
Count lines of code in Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute the following when inside your target project:
find . -name "*.[hm]" -print0 | xargs -0 wc -l
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of TableViews
Last active November 9, 2023 09:00
Sample iOS Unit Tests: Working with a ViewController composed of TableViews
import XCTest
@testable import YourAppTargetname
class SideMenuViewControllerTest: XCTestCase {
var viewControllerUnderTest: SideMenuViewController!
override func setUp() {
super.setUp()
@ccabanero
ccabanero / how-to-create-a-cocoa-pod
Last active April 1, 2023 04:43
How to Create a Cocoa Pod
Notes for Creating a Cocoa Pod
Pod Version: 0.39.0
OS: OS X El Capitain (10.11.3)
- - - - - - - - - - - - - - - - - - - - - - -
1. Install CocoaPods (https://guides.cocoapods.org/using/getting-started.html)
2. Create Xcode project to author the Pod
@ccabanero
ccabanero / Fade Out TitleView on Swipe
Last active November 30, 2022 03:33
Fade Out TitleView on Swipe
/**
For configuring the NavigationBar to show/hide when user swipes
- returns: void
*/
func configureNavigationBarAsHideable() {
if let navigationController = self.navigationController {
// respond to swipe and hide/show
navigationController.hidesBarsOnSwipe = true
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController that presents a UIAlertController
Last active September 4, 2022 20:17
Sample iOS Unit Tests: Working with a ViewController that presents a UIAlertController
func testControllerShowsAlertIfUserLogsInWithEmptyUsernameAndPasswordTextField() {
// mock of LoginViewController
class MockLoginViewController: LoginViewController {
var presentViewControllerTarget: UIViewController?
override func presentViewController(viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?) {
presentViewControllerTarget = viewControllerToPresent
}
}
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of CollectionViews
Last active August 16, 2022 03:07
Sample iOS Unit Tests: Working with a ViewController composed of CollectionViews
class ViewControllerTest: XCTestCase {
var systemUnderTest: ViewController!
override func setUp() {
super.setUp()
//get the storyboard the ViewController under test is inside
let storyboard: UIStoryboard = UIStoryboard(name: "Main_iPhone", bundle: nil)
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with NavigationItems
Last active July 9, 2022 19:22
Sample iOS Unit Tests: Working with NavigationItems
// example unit tests for UIBarButtonItem target - action pattern
import XCTest
@testable import to
class ViewControllerTest: XCTestCase {
var systemUnderTest: ViewController!
override func setUp() {
@ccabanero
ccabanero / Android - using LocationListener with Google Maps v2
Last active April 7, 2022 13:57
Android - using LocationListener with Google Maps v2
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import android.app.Activity;
import android.content.Context;
@ccabanero
ccabanero / git-ref
Last active February 25, 2022 16:27
git-ref
1. Create an empty develop branch (off of master) and pushes it to the server
git branch development
git push -u origin development
2. Clone the central repo and creates a tracking branch for develop
git clone url/to/repo
git checkout development
@ccabanero
ccabanero / AWS - Notes for installing Apache - PostgreSQL - PostGIS - PHP (LAPPP) on an AWS EC2 Ubuntu 12.04.2 Server for development.
Last active September 23, 2021 05:32
AWS - Notes for installing Apache - PostgreSQL - PostGIS - PHP (LAPPP) on an AWS EC2 Ubuntu 12.04.2 Server for development.
-------------------------------------------------------------------------------------------------------------------------------
DESCRIPTION:
Notes for installing Apache - PostgreSQL - PostGIS - PHP (LAPPP) on an AWS EC2 Ubuntu 16.x Server for development.
-------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------
PART 1: Stand Up an Ubuntu 16.x server on AWS EC2
---------------------------------------------------------