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 NPClientAPI : AFHTTPSessionManager | |
- (instancetype)initWithBaseURL:(NSString *)baseURL; | |
/** | |
Singleton object. | |
*/ | |
+ (NPClientAPI *)sharedAPI; | |
/** |
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
// CacheItem.h | |
@interface CacheItem : RLMObject | |
@property NSString *key; | |
@property NSData *value; | |
@end | |
// CacheItem.m | |
@implementation CacheItem |
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
// Core Animation Example: eggs falling out of a tree | |
// This was glommed from iphonedevsdk: http://www.iphonedevsdk.com/forum/iphone-sdk-development/65632-animation-sample-code-our-newest-app.html | |
// This is the main animation routine. | |
- (IBAction) doorEasterEggAction; | |
{ | |
//treeDoorImageView | |
CATransform3D theTransform; | |
UIImageView* anEgg; |
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
{ | |
"Afghanistan": { | |
"country_code": "+93", | |
"deliverability_rate": 77 | |
}, | |
"Albania": { | |
"country_code": "+355" | |
}, | |
"Algeria": { | |
"country_code": "+213", |
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
#include <stdio.h> | |
#include <string.h> | |
int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy); | |
float buffx[3]; | |
float buffy[3]; | |
main() | |
{ | |
buffx[0] = 1.0; buffy[0] = 1.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
// サンプル動画のパスを取得 | |
let bundle = NSBundle.mainBundle() | |
let url: NSURL = NSBundle.mainBundle().URLForResource("sample", withExtension: "mp4")! | |
// 動画のパスを指定してplayerItemを生成 | |
self.playerItem = AVPlayerItem(URL: url) | |
// 上で生成したplayerItemを指定してplayerを生成 | |
self.videoPlayer = AVPlayer(playerItem: self.playerItem) | |
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 UIKit | |
/* | |
I'm not sure why `@NSCopying` doesn't seem to be copying the object in the example below. | |
I'm attempting to write code that follows the "initialization with a configuration object" pattern, like `NSURLSession`. | |
Ideally the configuration would be a struct, but since I'm still interoperating with Obj-C that's not an option. | |
*/ | |
class Foo : NSObject, NSCopying { | |
var bar = "bar" |
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
// the cell creation logic | |
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UVLVideoCell *videoCell = (UVLVideoCell *)[collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([UVLVideoCell class]) forIndexPath:indexPath]; | |
NSInteger index = 1 + indexPath.item%2; | |
NSURL *sampleURL = [[NSBundle mainBundle] URLForResource:[NSString stringWithFormat:@"flak_0%i", index] withExtension:@"mp4" subdirectory:@"videos"]; | |
[videoCell loadVideoURL:sampleURL]; | |
return videoCell; |
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
/** | |
`ZebraPrinterStatus` is a list of status responses we handle from the printer or during a connection attempt with the printer. | |
*/ | |
enum ZebraPrinterStatus { | |
case Ready | |
case NotReady([ZebraPrinterError]) | |
case Unknown | |
func message() -> String { | |
switch self { |
OlderNewer