Skip to content

Instantly share code, notes, and snippets.

View iggym's full-sized avatar
🎯
😄

Iggy iggym

🎯
😄
View GitHub Profile
// To create a coupon or storecard feature in your app
// you can do the following
@interface Card : NSObject <KCSPersistable>
@property (nonatomic, retain) NSString *cardId;
@property (nonatomic, retain) NSString *code;
@property (nonatomic, retain) NSString *cardName;
@property (nonatomic, retain) NSString *firstName;
@property (nonatomic, retain) NSString *lastName;
// In your view controller
// Make sure you have a class that stores image metadata
// For example, you could have your MyMetadata class with
// the following iVars:
// name -- The name of the image
// size -- The expected size of the image
// date -- The time the picture was taken
// location -- The place the image was taken
// peopleInPhoto -- An array of the 'id' attribute from KCSUsers
// in the picture
@iggym
iggym / onpubcom_array_date_sort.js
Created November 8, 2012 22:32 — forked from onpubcom/onpubcom_array_date_sort.js
How to Sort an Array of Dates with JavaScript
<script type="text/javascript">
// First let's create an array of JavaScript Date
// objects.
// More info about the Date class:
// http://w3schools.com/js/js_obj_date.asp
var dates = [
new Date(2010, 4, 10, 10, 07, 16),
new Date(2010, 4, 8, 9, 16, 09),
new Date(2010, 3, 30, 0, 15, 49),
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds))];
scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
scrollView.pagingEnabled = YES;
[self.view addSubview:scrollView];
NSArray *images = @[@"image1", @"image2", @"image3"];
[images enumerateObjectsUsingBlock:^(NSString *imageName, NSUInteger idx, BOOL *stop) {
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]];
imageView.frame = CGRectMake(idx * CGRectGetWidth(self.view.bounds), 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds));
[self.scrollView addSubview:imageView];
//
// CCamera.h
// CCamera
//
// Created by Jonathan Wight on 7/12/12.
// Copyright (c) 2012 Jonathan Wight. All rights reserved.
//
#import <Foundation/Foundation.h>
- (void)setupCaptureSession
{
NSError *error = nil;
AVCaptureSession *session = [[AVCaptureSession alloc] init];
session.sessionPreset = AVCaptureSessionPresetMedium;
AVCaptureDevice *device = [AVCaptureDevice
defaultDeviceWithMediaType:AVMediaTypeVideo];
#import <UIKit/UIKit.h>
@interface MySegueWithCustomAnimation : UIStoryboardSegue
@end
GlobalConfiguration.Configuration.IncludeErrorDetailPolicy
= IncludeErrorDetailPolicy.Always;
var family = [{
"name" : "Jason",
"age" : "24",
"gender" : "male"
},
{
"name" : "Kyle",
"age" : "21",
"gender" : "male"
}];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:@"http://someurl/blah];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id resultJSON) {
[self processResult:resultJSON];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[self processFailuer:error];
}];
[operation start];