Skip to content

Instantly share code, notes, and snippets.

View vikingosegundo's full-sized avatar

Manuel Meyer vikingosegundo

  • Groningen, Netherlands
View GitHub Profile
//
// UIColor-HSVAdditions.h
//
// Created by Matt Reagan (bravobug.com) on 12/31/09.
//
//
// Copyright 2010 Fabián Cañas. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface MyDecimalNumber : NSDecimalNumber
@end
@implementation MyDecimalNumber
@vikingosegundo
vikingosegundo / gist:5356670
Last active December 16, 2015 01:39
fast enumeration vs. block enumeration
//
// main.m
// fastenumvsblockenum
#import <Foundation/Foundation.h>
@implementation NSMutableArray (RandomUtils)
-(void)shuffle
a answer to http://stackoverflow.com/questions/19087078/i-want-correct-format-of-this-code
First you should not use view's tag like that. Instead check the identity against a member/property.
Second I called your count variable idx — as it is a index variable.
As a pre-condition I check, if both arrays have the same size. Of course it would be much nicer to keep the information together: one NSDictionary per photo and caption. even better: a PhotoAlbumItem that stores both as properties.
#import <Foundation/Foundation.h>
NSUInteger euclid(NSUInteger a, NSUInteger b)
{
while (b > 0) {
if (a > b) {
a = a - b;
} else {
b = b - a;
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSString *jsonString = @"{\"corpUserWs\":{\"loginMsg\":\"User is locked out. Please request for your account to be unlocked.\",\"requestStatus\":0,\"sessionId\":\"16gxtse746yqj\"}}";
NSString *jsonString2 = @"[{\"corpUserWs\":{\"loginMsg\":\"User is locked out. Please request for your account to be unlocked.\",\"requestStatus\":0,\"sessionId\":\"16gxtse746yqj\"}}]";
NSMutableArray *array = [@[@1,@2,@3,@4,@5, @6, @7, @8,@9, @10] mutableCopy];
for (int i =0 ; i< [array count]; ++i) {
if ([array[i] integerValue]> 3 && [array[i] integerValue]< 8) {
[array removeObjectAtIndex:i];
}
}
// we want to get an array containg [@1, @2, @3, @8, @9, @10]
// but we get [@1, @2, @3, @5, @7, @8, @9, @10]
#import <Foundation/Foundation.h>
@interface Item : NSObject
@property NSInteger itemID;
@property NSInteger typeID;
@property(copy) NSString *itemDescription;
@end
@implementation Item
#import <Foundation/Foundation.h>
@interface Birthday : NSObject
@property (nonatomic, strong) NSDate *birthday;
@property (nonatomic, copy) NSString *name;
-(id)initWithName:(NSString *) name birthdayDate:(NSDate *) date;
@end
#import <Foundation/Foundation.h>
@interface MyClass : NSObject
- (NSString *)actualPhotoPath:(NSDictionary *)input;
@end
@implementation MyClass