Skip to content

Instantly share code, notes, and snippets.

View voznesenskym's full-sized avatar

Michael Voznesensky voznesenskym

View GitHub Profile
@voznesenskym
voznesenskym / crashingsubviews.playground
Created August 30, 2019 00:13
Swift playground demonstrating crash from UIView subview cycle
//: 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")
@voznesenskym
voznesenskym / tess_bulk_download.py
Last active January 10, 2020 11:24
Bulk Download the Toronto emotional speech set (TESS) https://tspace.library.utoronto.ca/handle/1807/
#!/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 = []
@voznesenskym
voznesenskym / git add, commit, push
Created March 7, 2015 09:20
Update your Fork of the Repository
git add --all .
git commit -m "your meaningful commit message"
git push origin master
@voznesenskym
voznesenskym / Clone it!
Last active August 29, 2015 14:16
Cloning your project
git clone https://github.com/yourname/AFNetworking.git
cd AFNetworking/
@voznesenskym
voznesenskym / mkdir open_source
Created March 7, 2015 08:47
Make a folder for your Open Source Projects!
cd $HOME/Desktop
mkdir open_source
cd open_source
@voznesenskym
voznesenskym / updated func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
Created January 19, 2015 02:12
updated func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
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
@voznesenskym
voznesenskym / func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
Created January 19, 2015 02:05
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
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!]
@voznesenskym
voznesenskym / UserHeaderTableViewCell.swift
Created January 19, 2015 01:56
UserHeaderTableViewCell.swift
import UIKit
protocol UserHeaderTableViewCellDelegate {
func didSelectUserHeaderTableViewCell(Selected: Bool, UserHeader: UserHeaderTableViewCell)
}
class UserHeaderTableViewCell: UITableViewCell {
var delegate : UserHeaderTableViewCellDelegate?
override func awakeFromNib() {
#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