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
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in | |
... | |
DispatchQueue.main.async { [unowned self] in | |
... | |
} | |
} | |
// Delay execution of the block | |
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { | |
... |
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
view.layoutIfNeeded() // Optional. Ensure that all pending layout operations have been completed | |
UIView.animateWithDuration(5) { | |
someConstraint.constant = 0 | |
self.view.layoutIfNeeded() // called on parent view | |
} |
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 git keeps asking the passkey: add it to the keychain | |
ssh-add -K ~/.ssh/id_rsa | |
//create and switch to a new branch | |
git checkout -b <branch> | |
//push new branch to a repo | |
git push -u origin <branch> |
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_representation| | |
installer_representation.project.targets.each do |target| | |
if target.name == 'Pods-Mixpanel' | |
target.build_configurations.each do |config| | |
if config.name == 'Debug' | |
puts " Pods-Mixpanel #{config.name} before: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].inspect}" | |
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)'] | |
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'DISABLE_MIXPANEL_AB_DESIGNER=1' | |
puts " Pods-Mixpanel #{config.name} after: #{config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].inspect}" | |
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
1. Delete your app from the device. | |
2. Turn the device off completely and turn it back on. | |
3. Go to Settings > General > Date & Time and set the date ahead a day or more. | |
4. Turn the device off completely again and turn it back on. | |
https://developer.apple.com/library/ios/technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG42 |
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
//listing | |
gsutil ls gs://arq-285486884533/ | |
//size | |
gsutil du -sh gs://arq-285486884533/ |
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
// Version check: | |
sudo gem list cocoapods | |
// Downgrade | |
sudo gem uninstall cocoapods | |
// Install required version | |
sudo gem install cocoapods -v 0.25.0 | |
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
// Singleton | |
final class Singleton { | |
static let shared = Singleton() | |
private init() { // forbid object creation | |
} | |
} | |
// Lazy | |
lazy var players = { |
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
mkdir -p ~/Library/Developer/Xcode/UserData/FontAndColorThemes; | |
cd ~/Library/Developer/Xcode/UserData/FontAndColorThemes; | |
curl -O https://dl.dropboxusercontent.com/u/1983175/EGOv2.dvtcolortheme | |
Now just restart Xcode, go to Preferences > Fonts & Colors, and select "EGO" or "EGOv2" from the color theme drop down. | |
http://developers.enormego.com/view/ego_xcode_theme_for_xcode_4_egov2 |
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
// Check if a view controller is popped from navigation stack (either by `popViewController` or interactive transition) | |
// Method 1 | |
override func didMove(toParentViewController parent: UIViewController?) { | |
super.didMove(toParentViewController: parent) | |
if parent == nil { // parent is `nil` when the vc is popped | |
} | |
} | |
// Method 2 | |
override func viewDidDisappear(animated: Bool) { |
OlderNewer