Skip to content

Instantly share code, notes, and snippets.

View gist:8456766c65816255830a
### Keybase proof
I hereby claim:
* I am tonymillion on github.
* I am tonymillion (https://keybase.io/tonymillion) on keybase.
* I have a public key whose fingerprint is 26F7 ED28 40B6 F654 F11D 0717 CE83 A8C8 2FB8 1A4B
To claim this, I am signing this object:
@tonymillion
tonymillion / gist:6727536
Created Sep 27, 2013
My CoreMotion activity since midnight 2013-09-27 00:00:00 BST (hence why it starts at 23:00) Also included number of steps (which is wrong because I cycled for 21 minutes)
View gist:6727536
queryStepCountStartingFrom: 2938, (null)
CMMotionActivity @ 16938.044398,<startDate,2013-09-26 23:26:23 +0000,confidence,2,unknown,0,stationary,1,walking,0,running,0,automotive,0>
CMMotionActivity @ 21445.548551,<startDate,2013-09-26 23:26:27 +0000,confidence,2,unknown,0,stationary,0,walking,0,running,0,automotive,0>
CMMotionActivity @ 21451.551333,<startDate,2013-09-26 23:26:33 +0000,confidence,2,unknown,0,stationary,1,walking,0,running,0,automotive,0>
CMMotionActivity @ 21451.551333,<startDate,2013-09-27 00:32:59 +0000,confidence,2,unknown,0,stationary,1,walking,0,running,0,automotive,0>
CMMotionActivity @ 25442.301711,<startDate,2013-09-27 00:33:03 +0000,confidence,2,unknown,0,stationary,0,walking,0,running,0,automotive,0>
CMMotionActivity @ 25449.247537,<startDate,2013-09-27 00:33:10 +0000,confidence,2,unknown,0,stationary,1,walking,0,running,0,automotive,0>
CMMotionActivity @ 25449.247537,<startDate,2013-09-27 03:50:34 +0000,confidence,2,unknown,0,stationary,1,walking,0,running,0,automotive,0>
CMMotionA
@tonymillion
tonymillion / gist:6716935
Last active Jun 6, 2018
force decoding of UIImage on load on iOS7 (so it can be done on a background thread not the UI thread).
View gist:6716935
+(UIImage*)immediateImageWithData:(NSData*)data
{
CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
CGImageRef cgImage = CGImageSourceCreateImageAtIndex(source, 0, (__bridge CFDictionaryRef)@{(id)kCGImageSourceShouldCacheImmediately: (id)kCFBooleanTrue});
UIImage *temp = [UIImage imageWithCGImage:cgImage];
CGImageRelease(cgImage);
CFRelease(source);
View gist:4501089
+ (NSArray *) MR_importFromArray:(NSArray *)listOfObjectData inContext:(NSManagedObjectContext *)context
{
NSMutableArray *objects = [NSMutableArray array];
[listOfObjectData enumerateObjectsWithOptions:0
usingBlock:^(id obj, NSUInteger idx, BOOL *stop)
{
NSDictionary * dict = obj;
if([dict isKindOfClass:[NSDictionary class]])
View gist:3554528
CGImageRef imgRef = [self.liveImageContext createCGImage:ciimg
fromRect:ciimg.extent];
UIImage *newimg = [UIImage imageWithCGImage:imgRef];
CGImageRelease(imgRef);
dispatch_async(dispatch_get_main_queue(), ^{
self.liveImageView.image = newimg;
});
You can’t perform that action at this time.