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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'ruby_odata' | |
svc = OData::Service.new "http://odata.netflix.com/Catalog/" | |
puts "DVD:" | |
svc.Titles.filter("AverageRating le 2 and Type eq 'Movie' and Dvd/Available eq true").order_by("AverageRating asc").top(100) | |
movies = svc.execute |
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 ClassName : NSObject | |
{ | |
int integer_instance_variable; | |
NSString *string_instance_variable; | |
//add ivars as needed | |
} | |
@end | |
@implementation ClassName |
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
-(void)dealloc { | |
delete obj; | |
[super dealloc]; | |
} |
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
NSNotificationCenter* notificationCenter = [NSNotificationCenter defaultCenter]; | |
[notificationCenter addObserverForName:UIApplicationDidBecomeActiveNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { | |
NSInteger count = [APPLICATION_COUNT_VALUE integerValue]; | |
count++; | |
[self.textLabel setText:[NSString stringWithFormat:@"%i", count]]; | |
}]; |
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
// | |
// Copyright (c) 2013 Apple Inc. All rights reserved. | |
// | |
// Copyright (c) 1997-2005, Sen:te (Sente SA). All rights reserved. | |
// | |
// Use of this source code is governed by the following license: | |
// | |
// Redistribution and use in source and binary forms, with or without modification, | |
// are permitted provided that the following conditions are met: | |
// |
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
if ([UIScreen mainScreen].scale == 2.0) { | |
// download 2x | |
} |
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
#import "ViewController.h" | |
@interface ViewController () <UITextFieldDelegate> | |
@property (strong, nonatomic) UITextField *textField; | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad | |
{ |
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
NSString* urlString = <# INSERT_URL_HERE #>; | |
CFHostRef _host; | |
CFSocketRef _socket; | |
assert(self->_host == NULL); | |
self->_host = CFHostCreateWithName(NULL, (__bridge CFStringRef) urlString); | |
assert(self->_host != NULL); | |
CFHostScheduleWithRunLoop(self->_host, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); | |
// CFHostStartInfoResolution(self->_host, kCFHostNames, 0); |
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
NSString* url = <# URL_HERE #>; | |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; |
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
NSString* textToShare = <# INPUT #>; | |
UIImage* imageToShare = <# INPUT #>; | |
NSArray* thingsToShare = @[textToShare, imageToShare]; | |
UIActivityViewController* activityViewController = [[UIActivityViewController alloc] initWithActivityItems:thingsToShare applicationActivities:nil]; | |
[self presentViewController:activityViewController animated:YES completion:nil]; |
OlderNewer