// jQuery
$(document).ready(function() {
// code
})
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder