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
@interface DownloadOperation : NSOperation | |
{ | |
NSURLRequest *request; | |
NSURLConnection *connection; | |
NSMutableData *receivedData; | |
} | |
@property(readonly) BOOL isExecuting; | |
@property(readonly) BOOL isFinished; |
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
""" This is a simple gist to show how to mock | |
private methods. I've got lots of questions | |
regarding this topic. Most people seems confused. | |
Hope it helps. | |
""" | |
import unittest | |
import mock |
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 collectionNames = db.getCollectionNames(), stats = []; | |
collectionNames.forEach(function (n) { stats.push(db[n].stats()); }); | |
stats = stats.sort(function(a, b) { return b['size'] - a['size']; }); | |
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); } |
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
// Swift4 | |
let image = UIImage(named: "sample") | |
let data = image?.pngData() | |
let data = image?.jpegData(compressionQuality: 0.9) | |
let uiImage: UIImage = UIImage(data: imageData) | |
// deprecated | |
// var imageData: Data = UIImagePNGRepresentation(image) |