Skip to content

Instantly share code, notes, and snippets.

View rtimpone's full-sized avatar

Rob Timpone rtimpone

View GitHub Profile
@rtimpone
rtimpone / sublime_preferences.json
Last active May 21, 2018 16:25
Sublime Preferences
{
"font_face": "SF Mono",
"font_size": 14.0,
"ignored_packages":
[
"Vintage"
],
"save_on_focus_lost": true,
"show_full_path": true
}
@rtimpone
rtimpone / AutoNibRegisteringTableView.swift
Last active April 10, 2018 14:52
An extension that allows UITableViews to automatically register nib-based UITableViewCells when it attempts to dequeue them. Makes working with nib-based table view cells much easier.
protocol NibBased {
static var nibName: String { get }
}
extension NibBased {
static var nibName: String {
return String(describing: self)
}
}
@rtimpone
rtimpone / AutoNibRegisteringCollectionView.swift
Created May 4, 2018 19:38
An extension that allows UICollectionViews to automatically register nib-based UICollectionViewCells when it dequeues them. Makes working with nib-based cells much easier.
import Foundation
import UIKit
protocol NibBased {
static var nibName: String { get }
}
extension NibBased {
static var nibName: String {
return String(describing: self)
@rtimpone
rtimpone / UIColor+Hex.swift
Created May 18, 2018 01:27
Create a UIColor from hex values
extension UIColor {
convenience init(hex: String) {
let trimmedString = hex.replacingOccurrences(of: "#", with: "")
var uint32Value: UInt32 = 0
Scanner(string: trimmedString).scanHexInt32(&uint32Value)
let intValue = Int(uint32Value)
import UIKit
protocol NibBased {
static var nibName: String { get }
}
extension NibBased {
static var nibName: String {
return String(describing: self)
@rtimpone
rtimpone / sync_airpods.applescript
Created June 26, 2019 18:21
Script to sync AirPods to a mac
-- Launch System Preferences
tell application "System Preferences" to activate
-- Open the 'Sound' preferences and select the 'Output' tab
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
end tell
tell application "System Events" to tell process "System Preferences"