Skip to content

Instantly share code, notes, and snippets.

View rodericj's full-sized avatar
🐔
chicken

Roderic Campbell rodericj

🐔
chicken
View GitHub Profile
RKEntityMapping* listMapping = [RKEntityMapping mappingForEntityForName:[FOFSList entityName] inManagedObjectStore:objectManager.managedObjectStore];
[listMapping addAttributeMappingsFromDictionary:@{
@"id": @"listID",
@"title": @"name",
@"description": @"desc",
@"user": @"user",
@"following": @"following",
// @"editable": @"editable",
@"collaborative": @"collaborative",
@"canonicalUrl": @"canonicalUrl",
RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"https://api.foursquare.com/"]];
objectManager.managedObjectStore = [self managedObjectStore];
RKEntityMapping* listMapping = [RKEntityMapping mappingForEntityForName:[FOFSList entityName] inManagedObjectStore:objectManager.managedObjectStore];
[listMapping addAttributeMappingsFromDictionary:@{
@"id": @"listID",
@"title": @"name",
@"description": @"desc",
@"user": @"user",
@"following": @"following",
(lldb) po [[[error userInfo] objectForKey:@"NSDetailedErrors"] objectAtIndex:0]
Error Domain=NSCocoaErrorDomain Code=1570 "The operation couldn’t be completed. (Cocoa error 1570.)" UserInfo=0x1201e290 {NSValidationErrorObject=<FOFSList: 0xf2357f0> (entity: FOFSList; id: 0x120939b0 <x-coredata://6D8CBDDD-DFD9-4463-9305-52EA03846EEE/FOFSList/p5> ; data: {
canonicalUrl = nil;
collaborative = nil;
collaborators = (
);
desc = nil;
editable = nil;
followers = (
);
[UIView animateKeyframesWithDuration:0.5 delay:0 options:UIViewKeyframeAnimationOptionCalculationModeLinear animations:^
{
CGRect newFrame = self.view.bounds;
newFrame.origin.y = newFrame.size.height;
[webView setFrame:newFrame];
}
completion:^(BOOL finished)
{
}];
RKEntityMapping* listMapping = [RKEntityMapping mappingForEntityForName:[FOFSList entityName]
inManagedObjectStore:objectManager.managedObjectStore];
[listMapping addAttributeMappingsFromDictionary:@{
@"id": @"listID",
@"title": @"name",
@"description": @"desc",
@"user": @"user",
@"following": @"following",
@"collaborative": @"collaborative",
@"canonicalUrl": @"canonicalUrl",
@rodericj
rodericj / gistify428545.m
Created March 19, 2014 04:35
Localized String sample
"SEARCHRESULTSTHATMATCHYOURPINS" = "Search results that match your pins:";
"SEARCHRESULTSINTHISMAPAREA" = "Search results in this map area:";
"SEARCHADIFFERENTLOCATION" = "Search a different location?";
"SEARCHLIST" = "Search List";
"SEARCHBAR" = "Search Bar";
// General
"OKTEXT" = "Ok";
"CANCELTEXT" = "Cancel";
"EDITTEXT" = "Edit";
DeviceSettingsHeaderView *headerView = [[DeviceSettingsHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, DEVICE_HEADER_HEIGHT)];
+
+ [RACObserve(self, device) subscribeNext:^(MorseDevice *newDevice) {
+
+ // When the battery level changes, update the string
+ RACSignal *batteryChangeSignal = RACObserve(newDevice, batteryLevel);
+ RAC(headerView.batteryAndWifiLabel, text) = [[batteryChangeSignal deliverOn:[RACScheduler mainThreadScheduler]] map:^id(id value) {
+
+ return [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"battery is at", nil), newDevice.batteryLevelString];
+ }];
- (void)viewDidLoad
{
[super viewDidLoad];
DeviceSettingsHeaderView *headerView = [[DeviceSettingsHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, DEVICE_HEADER_HEIGHT)];
[RACObserve(self, device) subscribeNext:^(MorseDevice *newDevice) {
// When the battery level changes, update the string
RACSignal *batteryChangeSignal = RACObserve(newDevice, batteryLevel);
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
...
...
// When the gain changes
RACSignal *gainChangeSignal = [RACObserve(self, device.gain) deliverOn:[RACScheduler mainThreadScheduler]];
// cell.auxiliaryLabel.text = @" ";
RAC(cell.auxiliaryLabel, text) = [gainChangeSignal map:^id(id value) {
// Get the gain lookup table
NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
UIView *wrapper = [UIView autoLayoutView];
[wrapper constrainToWidth:300];
self.textSubtextPairs = @[@{@"label": @"abcde",
@"detail": @"Bacon ipsum dolor sit amet sausage shank ball tip jowl shoulder spare ribs prosciutto leberkas sirloin pork cow bacon beef. Bacon drumstick tongue shank. Pancetta ribeye doner andouille tri-tip sirloin t-bone tenderloin sausage bacon. Ball tip salami pig frankfurter bacon meatloaf turkey ribeye boudin t-bone corned beef short ribs short loin tongue tenderloin. Meatball turducken swine kielbasa rump prosciutto doner, short ribs boudin shankle jowl shank pig short loin. Prosciutto drumstick pork belly shank meatball. Jowl frankfurter swine, spare ribs landjaeger strip steak flank t-bone ribeye ground round meatball kevin boudin leberkas.",
@"color" : [UIColor redColor]},
@{@"label": @"cdef",
@"deta