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
require "minitest/reporters" | |
Minitest::Reporters.use! |
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
myImageView.layer.cornerRadius = myImageView.frame.size.width / 2; | |
myImageView.clipsToBounds = YES; |
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
myImageView.layer.borderWidth = 3.0f; | |
myImageView.layer.borderColor = [UIColor whiteColor].CGColor; |
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
myImageView.layer.cornerRadius = 10.0f; |
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
tableView.estimatedRowHeight = 100 // estimated value for cell height | |
tableView.rowHeight = UITableViewAutomaticDimension |
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
// first enable "Refreshing" on controller via storyboard | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// the value for "action" must mach the function's name | |
refreshControl?.addTarget(self, action: "reloadStuff", forControlEvents: UIControlEvents.ValueChanged) | |
} | |
func reloadStuff() { |
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
navigationController?.popViewControllerAnimated(true) |
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
let text = "Text to get the match" | |
let regex = NSRegularExpression(pattern: "([^ ]+)", options: nil, error: nil)! | |
let matches = regex.matchesInString(text, options: nil, range: NSRange(location: 0, length: count(text))) | |
var substring = "" | |
for match in matches as! [NSTextCheckingResult] { | |
// range at index 0 returns the full match | |
// range at index 1 returns the first capture group | |
// range at index 2 returns the second capture group and so on... |
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 controller-based status bar appearance = NO | |
Status bar style = UIStatusBarStyleLightContent |
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
-(UIImage *)scaleImage:(UIImage *)image toWidth:(int)width { | |
// determine the scaling factor to fit the screen width | |
CGFloat oldWidth = image.size.width; | |
NSUInteger newWidth = (width - 10); | |
CGFloat scaleFactor; | |
if (oldWidth > newWidth) | |
scaleFactor = oldWidth / newWidth; | |
else |
OlderNewer