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
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate { | |
@IBOutlet weak var imageView: UIImageView! | |
@IBAction func choosePhoto(sender: UIButton) { | |
let picker = UIImagePickerController() | |
picker.delegate = self | |
picker.sourceType = .SavedPhotosAlbum | |
presentViewController(picker, animated: true, completion: 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
// | |
// AccessController.swift | |
// FriendChain | |
// | |
// Created by Ryan Davies on 20/11/2014. | |
// Copyright (c) 2014 Ryan Davies. All rights reserved. | |
// | |
import UIKit |
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
# | |
# Set the build number to the current git commit count. | |
# If we're using the Dev scheme, then we'll suffix the build | |
# number with the current branch name, to make collisions | |
# far less likely across feature branches. | |
# Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/ | |
# Found here: http://blog.jaredsinclair.com/post/97193356620/the-best-of-all-possible-xcode-automated-build | |
# | |
git=`sh /etc/profile; which git` | |
appBuild=`"$git" rev-list --all |wc -l` |
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; | |
@interface BlurView : UIView | |
@property (weak, nonatomic) UIView *backgroundView; | |
@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
UIGraphicsBeginImageContext(rect.size); | |
[view drawViewHierarchyInRect:rect afterScreenUpdates:NO]; | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); |
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
CLLocationManager *locationManager = [[CLLocationManager alloc] init]; | |
[locationManager setDelegate:self]; | |
[locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters]; | |
[self setLocationManager:locationManager]; | |
// ... | |
CLLocationCoordinate2D eiffelTowerCoordinates = CLLocationCoordinate2DMake(48.858093, 2.294694); | |
CLLocationDistance radius = 20; // 20 meters | |
CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter:eiffelTowerCoordinates radius:20.0 identifier:@"Eiffel Tower"]; |
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
// grab the model: | |
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"StoreMigration" withExtension:@"momd"]; | |
NSManagedObjectModel *managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; | |
// create a new example store type: | |
NSPersistentStoreCoordinator *csvCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel]; | |
csvCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel]; | |
if (![csvCoordinator addPersistentStoreWithType:[SMGCSVStore type] configuration:nil URL:csvStoreURL options:nil error:&error]) { | |
NSLog(@"Couldn't add store: %@", [error localizedDescription]); | |
abort(); |
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
existing_format = /\/\/\n\/\/ .*\n\/\/ .*\n\/\/\n\/\/.*\n\/\/.*\n\/\/\n/ | |
new_format = <<EOF | |
// The MIT License | |
// | |
// Copyright (c) 2013 Ryan Davies | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights |
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
#!/usr/bin/env ruby | |
class String | |
def starts_with?(prefix) | |
prefix = prefix.to_s | |
self[0, prefix.length] == prefix | |
end | |
end | |
old = 'RJD' # old prefix |
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
svn status --no-ignore | grep -E '(^\?)|(^\I)' | sed -e 's/^. *//' | sed -e 's/\(.*\)/"\1"/' | xargs rm -rf |