Skip to content

Instantly share code, notes, and snippets.

View alexpaul's full-sized avatar
:octocat:

Alex Paul alexpaul

:octocat:
View GitHub Profile
@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"
//
// UIViewController+Additions.h
// Events
//
// Created by Alex Paul on 5/26/18.
// Copyright © 2018 Alex Paul. All rights reserved.
//
#import <UIKit/UIKit.h>
@alexpaul
alexpaul / FirebaseSetup.md
Last active June 1, 2018 20:31
A Firebase startup guide. Built against Firebase 4.11.0. Also includes a Unit Test file (FirebaseTests.swift) that tests against CRUD functions.

Firebase: Quick Start Guide

Firebase Console

It all starts at the Firebase console

Steps

  1. Add a new project

  2. Add Firebase to your iOS app.

@alexpaul
alexpaul / StoryboardInstance.swift
Created June 2, 2018 21:50
Returns the instance of a storyboard view controller
public static func storyboardInstance() -> CustomViewController {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let customViewController = storyboard.instantiateViewController(withIdentifier: "CustomViewController") as! CustomViewController
return customViewController
}

Installing Xcode 10 Beta (Release June 4, 2018)

Navigate here to download Xcode 10 beta.

Size of download 5.3GB Installation size is 11.7GB

Xcode 10 beta release notes

Xcode 10 beta requires a Mac running macOS 10.13.4 or later.

@alexpaul
alexpaul / WWDC-2018-Useful-Links.md
Last active June 12, 2018 18:47
A list of useful links for WWDC 2018
@alexpaul
alexpaul / Login.js
Created June 9, 2018 23:11
A basic login component with two TextInput's and a TouchableHighLight
import React, { Component } from 'react'
import { View,
TextInput,
Text,
Alert,
TouchableHighlight,
StyleSheet } from 'react-native'
export default class Login extends Component {
constructor(props) {
@alexpaul
alexpaul / FetchAPI.js
Created June 11, 2018 23:57
Using Javascript's Fetch API to make a GET request
fetch('YOUR ENDPOINT HERE')
.then(response => response.json())
.then(jsonData => console.log(jsonData))
.catch(err => console.error(err))
@alexpaul
alexpaul / SrollToTopFlatList.js
Created June 12, 2018 09:46
Scroll to the top of a FlatList in react-native
<FlatList...
data={}
renderItem={}
keyExtractor={}
ref={'listRef'}
/>
onAction = () => {
this.refs.listRef.scrollToOffset({x:0, y:0, animated:true})
}