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
(from :http://www.entropy.ch/blog/Developer/2010/04/15/Git-diff-for-Localizable-strings-Files.html) | |
First, add this to the project’s .git/info/attributes file: | |
+ | |
*.strings diff=localizablestrings | |
(Unfortunately you do have to add it to every project, there doesn’t seem to be a global attributes configuration file) | |
Second, add this to your ~/.gitconfig 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 "SPVMainViewController.h" | |
@implementation SPVMainViewController | |
{ | |
UIView *_weightView; | |
UIPanGestureRecognizer *_recog; | |
} | |
- (void)viewDidLoad | |
{ |
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
// request Game Center verification data for localPlayer from apple | |
- (void)authenticateGameCenterPlayer:(GKLocalPlayer *)localPlayer | |
{ | |
[localPlayer generateIdentityVerificationSignatureWithCompletionHandler:^(NSURL *publicKeyUrl, NSData *signature, NSData *salt, uint64_t timestamp, NSError *error) { | |
if (error) { | |
NSLog(@"ERROR: %@", error); | |
} | |
else { | |
// package data to be sent to server for verification | |
NSDictionary *params = @{@"publicKeyUrl": publicKeyUrl, |
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
/// custom unique identifier | |
/// @see https://www.firebase.com/blog/2015-02-11-firebase-unique-identifiers.html | |
private let ASC_CHARS = Array("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz") | |
private let DESC_CHARS = ASC_CHARS.reverse() | |
private var lastPushTime: UInt64 = 0 | |
private var lastRandChars = Array<Int>(count: 12, repeatedValue: 0) | |
func generatePushID(ascending: Bool = true) -> String { | |
let PUSH_CHARS = ascending ? ASC_CHARS: DESC_CHARS | |
var timeStampChars = Array<Character>(count: 8, repeatedValue: PUSH_CHARS.first!) |
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 CoreData | |
protocol Fetchable | |
{ | |
typealias FetchableType: NSManagedObject | |
static func entityName() -> String | |
static func objectsInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> [FetchableType] | |
static func singleObjectInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> FetchableType? | |
static func objectCountInContext(context: NSManagedObjectContext, predicate: NSPredicate?) -> Int |
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 UIImage { | |
subscript (x: Int, y: Int) -> UIColor? { | |
guard x >= 0 && x < Int(size.width) && y >= 0 && y < Int(size.height), | |
let cgImage = cgImage, | |
let provider = cgImage.dataProvider, | |
let providerData = provider.data, | |
let data = CFDataGetBytePtr(providerData) else { | |
return 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
package main | |
import ( | |
"net/http" | |
"log" | |
) | |
func redirect(w http.ResponseWriter, req *http.Request) { | |
// remove/add not default ports from req.Host | |
target := "https://" + req.Host + req.URL.Path | |
if len(req.URL.RawQuery) > 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
import UIKit | |
class MyViewController: UIViewController { | |
// Store ref and handle as implicitly unwrapped optionals | |
var ref: Firebase! | |
var handle: UInt! | |
override func viewDidLoad() { | |
super.viewDidLoad() |
OlderNewer