This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
class MyViewController : UIViewController { | |
override func loadView() { | |
let crash = true | |
let viewA = UIView.singleLabelNamedView("a") | |
let viewB = UIView.singleLabelNamedView("b") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Python Version: 3.4.2 | |
# bs4 version: 4.3.2-2 | |
from urllib.request import urlopen | |
from bs4 import BeautifulSoup | |
import pickle | |
links = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git add --all . | |
git commit -m "your meaningful commit message" | |
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/yourname/AFNetworking.git | |
cd AFNetworking/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd $HOME/Desktop | |
mkdir open_source | |
cd open_source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | |
var header = tableView.dequeueReusableCellWithIdentifier("userheader") as UserHeaderTableViewCell | |
header.delegate = self | |
var id = contactsManager.arrayOfArraysOfContacts[section][0].accountId | |
var account : Account? = AccountsManager.sharedInstance.allAccountsAsDictionaries[id!] | |
header.textLabel?.text = account!.name | |
header.textLabel?.textColor = UIColor.blackColor() | |
header.contentView.backgroundColor = UIColor.whiteColor() | |
return header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | |
var header = tableView.dequeueReusableCellWithIdentifier("userheader") as UITableViewCell | |
//arrayOfArraysOfContacts is a 2D array of contacts by section | |
//Each contact has an accountID, and we pull the first one on each section | |
var id = contactsManager.arrayOfArraysOfContacts[section][0].accountId | |
//We use the ID to find the correct corresponding account in a dictionary | |
var account : Account? = AccountsManager.sharedInstance.allAccountsAsDictionaries[id!] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
protocol UserHeaderTableViewCellDelegate { | |
func didSelectUserHeaderTableViewCell(Selected: Bool, UserHeader: UserHeaderTableViewCell) | |
} | |
class UserHeaderTableViewCell: UITableViewCell { | |
var delegate : UserHeaderTableViewCellDelegate? | |
override func awakeFromNib() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate]) | |
#define UserDefaults [NSUserDefaults standardUserDefaults] | |
#define NotificationCenter [NSNotificationCenter defaultCenter] | |
#define SharedApplication [UIApplication sharedApplication] | |
#define Bundle [NSBundle mainBundle] | |
#define MainScreen [UIScreen mainScreen] | |
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES | |
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO | |
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x | |
#define NavBar self.navigationController.navigationBar |