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
extension UITableView { | |
func hideEmptyCells() { | |
tableFooterView = UIView() | |
} | |
/// Layout an auto layout header view | |
func setAndLayoutTableHeaderView(_ header: UIView) { | |
header.setNeedsLayout() | |
header.layoutIfNeeded() | |
header.frame.size = header.systemLayoutSizeFitting(UILayoutFittingCompressedSize) |
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
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH=/Users/geek/.oh-my-zsh | |
# Set name of the theme to load. Optionally, if you set this to "random" | |
# it'll load a random theme each time that oh-my-zsh is loaded. | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
ZSH_THEME="powerlevel9k/powerlevel9k" |
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
Parse.Cloud.define('hello', async (req, res) => { | |
return 'OK!'; | |
}); | |
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
public extension Array where Element: Hashable { | |
func sync(with array: Array) -> Array { | |
print("before:\(self)") | |
var seen = Set<Element>() | |
let result = filter{ seen.insert($0).inserted } | |
print("after: \(result)") | |
return result | |
} | |
} |
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
cat ~/.ssh/id_rsa.pub | ssh root@host "cat >> ~/.ssh/authorized_keys" |
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
~/Library/Developer/CoreSimulator/Devices |
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 ObjectMapper | |
class CustomDateTransform: TransformType { | |
static let dateFormatter: DateFormatter = { | |
let df = DateFormatter() | |
df.dateFormat = "yyyy-MM-dd" | |
return df | |
}() | |
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
post_install do |installer| | |
installer.pods_project.build_configurations.each do |config| | |
config.build_settings.delete('CODE_SIGNING_ALLOWED') | |
config.build_settings.delete('CODE_SIGNING_REQUIRED') | |
end | |
end |
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 | |
final class SearchViewController: UITableViewController { | |
private var searchController: UISearchController! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
searchController = UISearchController(searchResultsController: nil) |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
var str = "Hello, playground" | |
let students = ["Kofi", "Abena", "Efua", "Kweku", "Akosua"] | |
let studentsByLetter = Dictionary(grouping: students, by: { $0.first! }) | |
print(studentsByLetter) | |
// ["E": ["Efua"], "K": ["Kofi", "Kweku"], "A": ["Abena", "Akosua"]] |