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
#!/bin/bash | |
# | |
# Opens any xcworkspace or xcodeproj found in the current directory in Xcode. | |
# | |
openfile () ( | |
file="$1" | |
echo "Opening $file"; | |
open $file; | |
) |
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 | |
extension UIView | |
{ | |
func shake() | |
{ | |
let shakeAngle = (5 * M_PI) / 360 | |
let shakeRotation = CAKeyframeAnimation(keyPath: "transform.rotation") |
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
// Random number between 0 and n | |
let n = 42 | |
let randomNumber = Int(arc4random_uniform(n)) | |
// Instantiate a view controller that exists in a storyboard | |
let storyboardName = "Main" | |
let storyboard = UIStoryboard(name: storyboardName, bundle: nil) | |
let storyboardIdForViewController = "MyVC" // Specified in IB on the specific view controller instance | |
let myVc: MyViewController = storyboard.instantiateViewControllerWithIdentifier(storyboardIdForViewController) as! MyViewController |
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
CGFloat height = self.tableView.bounds.size.height - [UIApplication sharedApplication].statusBarFrame.size.height; | |
height = height - self.navigationController.navigationBar.frame.size.height; | |
height = height - self.tabBarController.tabBar.bounds.size.height; |
NewerOlder