// jQuery
$(document).ready(function() {
// code
})
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
- (void)md5HashFromUIImage:(UIImage*)image | |
hash:(unsigned char*)hash | |
{ | |
CGDataProviderRef dataProvider = CGImageGetDataProvider(image.CGImage); | |
NSData *data = (NSData*)CFBridgingRelease(CGDataProviderCopyData(dataProvider)); | |
CC_MD5([data bytes], [data length], hash); | |
} | |
- (BOOL)compareUIImages:(UIImage*)image1 | |
image:(UIImage*)image2 |
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
NSArray *fontFamilies = [UIFont familyNames]; | |
for (int i = 0; i < [fontFamilies count]; i++){ | |
NSString *fontFamily = fontFamilies[i]; | |
NSArray *fontNames = [UIFont fontNamesForFamilyName:fontFamilies[i]]; | |
NSLog (@"%@: %@", fontFamily, fontNames); | |
} |
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
#define FLT_EQUAL(a, b) (fabs((a) - (b)) < FLT_EPSILON) | |
#define FLT_ZERO(a) (fabs(a) < FLT_EPSILON) |
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
- (BOOL)addSkipBackupAttribute{ | |
if (![[NSFileManager defaultManager] fileExistsAtPath:[self path]]) return NO; | |
NSError *error = nil; | |
BOOL success = [self setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error]; | |
if(!success){ | |
NSLog(@"Error excluding %@ from backup %@", [self lastPathComponent], error); | |
} | |
return success; | |
} |
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 Foundation | |
/// An abstract class that makes building simple asynchronous operations easy. | |
/// Subclasses must implement `execute()` to perform any work and call | |
/// `finish()` when they are done. All `NSOperation` work will be handled | |
/// automatically. | |
open class AsynchronousOperation: Operation { | |
// MARK: - Properties |
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
/* | |
var t = Timer() | |
t.start() | |
// do something | |
t.stop() | |
print("took \(t.seconds)") | |
*/ |
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
// | |
// main.swift | |
// Routes | |
// | |
// Created by Chris Eidhof on 17/08/14. | |
// Copyright (c) 2014 Chris Eidhof. All rights reserved. | |
// | |
import Foundation |
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
public enum NotificationKey: String { | |
case UserSignedIn = "UserSignedInNotification" | |
case UserSignedOut = "UserSignedOutNotification" | |
case SomeOtherEvent = "SomeOtherEventNotification" | |
} | |
extension NSNotificationCenter { | |
func addObserver(observer: AnyObject, selector aSelector: Selector, key aKey: NotificationKey) { | |
self.addObserver(observer, selector: aSelector, name: aKey.rawValue, object: 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
// MARK: - Box | |
final public class Box<T> { | |
public let unbox:T | |
public init(_ value: T) { self.unbox = value } | |
} | |
// MARK: - Result enum | |
public enum Result<T: Printable> { |
OlderNewer