Skip to content

Instantly share code, notes, and snippets.

View harichinthalapale's full-sized avatar

Hari Chinthalapale harichinthalapale

View GitHub Profile
@harichinthalapale
harichinthalapale / gist:3379084
Created August 17, 2012 14:24
Multi-button header toolbar
UIToolbar *tools = [[UIToolbar alloc]
initWithFrame:CGRectMake(0.0f, 0.0f, 103.0f, 44.01f)]; // 44.01 shifts it up 1px for some reason
tools.clearsContextBeforeDrawing = NO;
tools.clipsToBounds = NO;
tools.tintColor = [UIColor colorWithWhite:0.305f alpha:0.0f]; // closest I could get by eye to black, translucent style.
// anyone know how to get it perfect?
tools.barStyle = -1; // clear background
NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:3];
// Create a standard refresh button.
@harichinthalapale
harichinthalapale / gist:3236777
Created August 2, 2012 12:43
sanitized values for html data
+ (NSString *) sanitizeValue: (NSString *)value
{
NSString *sanitizedValue = [value stringByReplacingOccurrencesOfString:@"&" withString:@"&"];
sanitizedValue = [sanitizedValue stringByReplacingOccurrencesOfString:@""" withString:@"\""];
sanitizedValue = [sanitizedValue stringByReplacingOccurrencesOfString:@"’" withString:@"'"];
sanitizedValue = [sanitizedValue stringByReplacingOccurrencesOfString:@"“" withString:@"'"];
return sanitizedValue;
}
@harichinthalapale
harichinthalapale / gist:3129471
Created July 17, 2012 13:45
Right align view
CGRect _f = CGRectMake(0, 0, 200, 200);
CGFloat xPosition = CGRectGetWidth(self.view.frame) - CGRectGetWidth(_f);
_f.origin = CGPointMake(ceil(xPosition), 0.0);
@harichinthalapale
harichinthalapale / crossdomain.xml
Created June 8, 2012 19:20
crossdomain sample
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
<!-- Most restrictive policy: -->
<site-control permitted-cross-domain-policies="none"/>