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
// | |
// How to enable automatic observer notification | |
// | |
// Created by Danilo Priore on 03/04/12. | |
// Copyright (c) 2012 Prioregroup.com. All rights reserved. | |
// | |
- (id)init { | |
if (self = [super init]) { | |
[self addObserverNotifications]; | |
} |
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
// Created by Danilo Priore on 02/04/12. | |
// Copyright (c) 2011 Prioregroup.com. All rights reserved. | |
// | |
// Copy object with property values | |
// | |
- (id)copy { | |
id copied = [[[self class] alloc] init]; | |
unsigned int count = 0; | |
objc_property_t *properties = class_copyPropertyList([self class], &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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Collections.Specialized; | |
using System.Text; | |
// ASP.NET [C#] REDIRECT WITH POST DATA | |
public static class WebExtensions | |
{ |
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
/* | |
This generic SOAP client allows you to access web services using a your iOS app. | |
https://github.com/priore/SOAPEngine | |
With this Framework you can create iPhone and iPad Apps that supports SOAP Client Protocol. This framework able executes methods at remote web services with SOAP standard protocol. | |
** Features | |
* Support both 2001 (v1.1) and 2003 (v1.2) XML schema. | |
* Support array, array of structs and dictionary. | |
* Support user-defined object. Capable of serializing complex data types and array of complex data types, even multi-level embedded structs. |
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
// MD5 | |
#import <CommonCrypto/CommonDigest.h> | |
- (NSString*)getMD5WithString: (NSString*)str{ | |
// Create pointer to the string as UTF8 | |
const char *ptr = [str UTF8String]; | |
// Create byte array of unsigned chars | |
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH]; | |
// Create 16 byte MD5 hash value, store in buffer |
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
// fix for Facebook SDK bug (from 3.0 to 3.7.1) https://developers.facebook.com/bugs/111727002307769 | |
- (void)getUserDataPermissionsComplete:(void(^)(NSArray *permissions, NSError *error))completeBlock { | |
FBRequest *requestPermissions = [FBRequest requestWithGraphPath:@"me/permissions" parameters:Nil HTTPMethod:@"GET"]; | |
[requestPermissions startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) { | |
if (completeBlock) { | |
NSMutableArray *permiss = [NSMutableArray array]; | |
NSArray *data = [(NSDictionary*)result objectForKey:@"data"]; | |
if (data && data.count > 0) { | |
NSDictionary *dict = [data objectAtIndex: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
// SHA1 | |
#import <CommonCrypto/CommonDigest.h> | |
- (NSString*)getSHA1WithString:(NSString*)string | |
{ | |
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; | |
uint8_t digest[CC_SHA1_DIGEST_LENGTH]; | |
CC_SHA1(data.bytes, (CC_LONG)data.length, digest); | |
NSMutableString *output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2]; | |
for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) |
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 <QuartzCore/QuartzCore.h> | |
// create a perfect circle view | |
- (UIView*)createCircleViewWithRadius:(int)radius | |
{ | |
// circle view | |
UIView *circle = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 2 * radius, 2 * radius)] autorelease]; | |
circle.layer.cornerRadius = radius; | |
circle.layer.masksToBounds = YES; |
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
// | |
// how to retrieve the current displayed viewcontroller | |
// | |
+ (UIViewController*)topMostController | |
{ | |
UIViewController *topController = [[UIApplication sharedApplication] keyWindow].rootViewController; | |
while (topController.presentedViewController) { | |
topController = topController.presentedViewController; | |
} | |
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
@implementation UIButton (Style) | |
const CGFloat kImageTopOffset = -15; | |
//const CGFloat kTextBottomOffset = -30; | |
- (void)centerButtonImageTopAndTextBottomWithOffset:(CGFloat)bottomOffset | |
{ | |
[self setTitleEdgeInsets:UIEdgeInsetsMake(0.0, -self.imageView.image.size.width, -bottomOffset, 0.0)]; | |
[self setImageEdgeInsets:UIEdgeInsetsMake(kImageTopOffset, 0.0, 0.0, -self.titleLabel.bounds.size.width)]; | |
} |
OlderNewer