I hereby claim:
- I am rsattar on github.
- I am riz (https://keybase.io/riz) on keybase.
- I have a public key whose fingerprint is 8D35 6F48 F552 DB52 8CAC 0B3E 3819 B5B4 9E06 49AF
To claim this, I am signing this object:
// This code checks one time if the security panel is closed. | |
// When you open the security panel, you should run this test | |
// repeatedly with a timer (every 500ms seems to work well). | |
// If the security panel is closed, you can then clean up your timers | |
protected function securityPanelIsClosed():Boolean | |
{ | |
// Why not just wait for an event from the SettingsPanel to know that it's closed? Because there isn't one. | |
// See http://bugs.adobe.com/jira/browse/FP-41 | |
var closed:Boolean = true; |
com.foo.MyApp.prototype.launchIOSAppOrITunesLink = function() { | |
// Listen for the Safari window to be deactivated | |
goog.events.listen(window, goog.events.EventType.BLUR, this.onMobileAppDetected, false, this); | |
// Launch the mobile app protocol and *ALSO* launch a timer | |
// that checks if the app was launched (it would have deactivated the mobile browser) | |
goog.Timer.callOnce(this.launchMobileApp, 100, this); | |
goog.Timer.callOnce(this.checkAppState, 600, this); | |
}; |
// I had a need to replace the use of RegexKitLite's arrayOfCaptureComponentsMatchedByRegex with | |
// the built-in NSRegularExpression in iOS 5+, and didn't find an existing example, so I wrote one: | |
- (NSArray *) arrayOfCaptureComponentsOfString:(NSString *)data matchedByRegex:(NSString *)regex | |
{ | |
NSError *error = NULL; | |
NSRegularExpression *regExpression = [NSRegularExpression regularExpressionWithPattern:regex options:NSRegularExpressionCaseInsensitive error:&error]; | |
NSMutableArray *test = [NSMutableArray array]; | |
// Sometimes Socket.IO "batches" up messages in one packet, | |
// so we have to split them. | |
// | |
- (NSArray *)packetsFromPayload:(NSString *)payload | |
{ | |
// "Batched" format is: | |
// �[packet_0 length]�[packet_0]�[packet_1 length]�[packet_1]�[packet_n length]�[packet_n] | |
// Requires Security.framework on Cocoa and Cocoa-Touch | |
#import <CommonCrypto/CommonDigest.h> | |
- (NSString *)avoSigFromUserEmailHash:(NSString *)userEmailHash developerKey:(NSString *)developerKey developerId:(NSString *)developerId | |
{ | |
NSString *combo = [userEmailHash stringByAppendingString:developerKey]; | |
unsigned char result[CC_SHA256_DIGEST_LENGTH]; | |
const char *combined = [combo UTF8String]; | |
CC_SHA256(combined, [combo lengthOfBytesUsingEncoding:NSUTF8StringEncoding], result); |
I hereby claim:
To claim this, I am signing this object:
// Inspired by: http://stackoverflow.com/a/5314634/9849 | |
// Simplified if-statements | |
// Updated to "modern" syntax | |
// Support optional CLHeading | |
// Support degree-of-precision | |
// | |
// This dictionary should then be added to the normal | |
// metadata using the kCGImagePropertyGPSDictionary key | |
- (NSDictionary *)GPSDictionaryForLocation:(CLLocation *)location heading:(CLHeading *)heading | |
{ |
// | |
// UIView+BorderViews.h | |
// Cluster | |
// | |
// Created by Rizwan Sattar on 4/1/14. | |
// Copyright (c) 2014 Cluster Labs, Inc. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
// See: http://stackoverflow.com/a/18833311/9849 | |
if (self.displayAsCenteredTableView) { | |
if (tableView == self.tableView) { | |
CGFloat cornerRadius = 7.f; | |
cell.backgroundColor = UIColor.clearColor; | |
CAShapeLayer *fillLayer = [[CAShapeLayer alloc] init]; | |
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; | |
CGMutablePathRef pathRef = CGPathCreateMutable(); |
// In .h | |
typedef NS_ENUM(NSInteger, ClusterAPIClusterMediaKind) { | |
ClusterAPIClusterMediaKindPhoto = 1 << 1, | |
ClusterAPIClusterMediaKindVideo = 1 << 2, | |
ClusterAPIClusterMediaKindText = 1 << 3, | |
ClusterAPIClusterMediaKindFancyText = 1 << 4, | |
ClusterAPIClusterMediaKindLocation = 1 << 5, | |
}; | |