Skip to content

Instantly share code, notes, and snippets.

@gunnarblom
gunnarblom / gist:5670284
Last active Dec 17, 2015
Sharing parent value when mapping a list of objects
View gist:5670284
// {
// "category": "MyCategory"
// "items": [
// { "id": 1, "name": "A" },
// { "id": 2, "name": "B" },
// { "id": 3, "name": "C" }
// ]
// }
// Current mapping, but missing "category" object that should be mapped to each "Item"
@gunnarblom
gunnarblom / gist:5677324
Created May 30, 2013
Make it possible to access willMapDeserializedResponseBlock to modify the deserialized JSON response when you are using RKObjectManager.
View gist:5677324
@interface RKObjectManager (ModifyJSONRepsonse)
- (void)getObjectsAtPath:(NSString *)path
parameters:(NSDictionary *)parameters
modifyResponseBlock:(id (^)(id deserializedResponseBody))modifyResponseBlock
success:(void (^)(RKObjectRequestOperation *operation, RKMappingResult *mappingResult))success
failure:(void (^)(RKObjectRequestOperation *operation, NSError *error))failure;
- (void)getObjectsAtPathForRelationship:(NSString *)relationshipName
ofObject:(id)object
View gist:9d73aa4358f3dafe2fd6808f7d4e9f41
- (WarpResultC*)warpImageWithGeoTransform:(NSArray<NSNumber*>*)geoTransformArray sourceFile:(NSString*)inFilepath destinationFile:(NSString*)outFilepath
{
GDALAllRegister();
GDALDriverH hDriver;
GDALDataType eDT;
GDALDatasetH hDstDS;
GDALDatasetH hSrcDS;
// Open the source file.
View file.mm
- (WarpResultC*)warpImageWithGeoTransformMBTiles:(NSArray<NSNumber*>*)geoTransformArray sourceFile:(NSString*)inFilepath destinationFile:(NSString*)outFilepath
{
char *argv[] = { strdup("gdal_translate"),
strdup("-of"), strdup("MBTILES"),
strdup(inFilepath.UTF8String), strdup(outFilepath.UTF8String),
NULL };
int argc = sizeof(argv) / sizeof(char*) - 1;
GDALDatasetH hDataset, hOutDS;