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
async function fn(){ | |
let err = new Error('whaever'); | |
err.code = 300; | |
throw err; | |
} | |
function catchCondition(conditions){ | |
return function(err){ | |
conditions = Array.isArray(conditions) ? conditions : [conditions]; | |
conditions.forEach((condition)=>{ |
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
<View style={styles.carouselContainer}> | |
<Carousel> | |
<View> | |
<Text>Page 1</Text> | |
</View> | |
<View> | |
<Text>Page 2</Text> | |
</View> | |
<View> | |
<Text>Page 3</Text> |
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
renderChildren() { | |
var Child, children = []; | |
for (var i = 0, l = this.props.children.length; i < l; i++) { | |
Child = this.props.children[i]; | |
children.push(<Child key={i} />); | |
} | |
return children; | |
}, | |
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
// save: | |
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | |
[userDefaults setObject:accessToken forKey:LINKEDIN_TOKEN_KEY]; | |
[userDefaults setDouble:expiration forKey:LINKEDIN_EXPIRATION_KEY]; | |
[userDefaults setDouble:[[NSDate date] timeIntervalSince1970] forKey:LINKEDIN_CREATION_KEY]; | |
[userDefaults synchronize]; | |
// delete | |
[userDefaults setObject:nil forKey:LINKEDIN_TOKEN_KEY]; |
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
[manager GET:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
NSMutableDictionary * resp = [responseObject mutableCopy]; | |
[resp setObject:accessToken forKey:@"access_token"]; | |
[resp setObject:expiresOn forKey:@"expires_in"]; | |
NSLog(@"JSON: %@", resp); | |
callback(@[[NSNull null],resp]); | |
return [self.bridge.eventDispatcher sendDeviceEventWithName:@"linkedinGetRequest" | |
body:resp]; | |
{ |
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
NSTimeInterval expiresOn = [[[ NSUserDefaults standardUserDefaults ] objectForKey:@"expires_in"] doubleValue]; | |
[manager POST:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
NSMutableDictionary * resp = [responseObject mutableCopy]; | |
[resp setObject:accessToken forKey:@"access_token"]; | |
[resp setObject:expiresOn forKey:@"expires_in"]; // error | |
NSLog(@"JSON: %@", responseObject); | |
callback(@[[NSNull null],responseObject]); | |
return [self.bridge.eventDispatcher sendDeviceEventWithName:@"linkedinGetRequest" | |
body:responseObject]; |
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
NSString *err = [ NSString stringWithFormat:@"Quering accessToken failed %@",error ]; | |
NSLog(err); | |
callback(@[err, [NSNull null]]); |
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
RCT_EXPORT_METHOD(login:(NSString *)clientId redirectUrl:(NSString *)redirectUrl clientSecret:(NSString *)clientSecret state:(NSString *)state scopes:(NSArray *)scopes callback:(RCTResponseSenderBlock)callback) | |
{ | |
self.clientId = clientId; | |
self.redirectUrl = redirectUrl; | |
self.clientSecret = clientSecret; | |
self.state = state; | |
self.scopes = scopes; | |
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
RCT_EXPORT_METHOD(addEvent:(NSString *)name location:(NSString *)location date:(NSNumber *)secondsSinceUnixEpoch) | |
{ | |
NSDate *date = [RCTConvert NSDate:secondsSinceUnixEpoch]; | |
} |
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
// | |
// LinkedinStorage.m | |
// SydTechEco | |
// | |
// Created by yanivkalfa on 3/13/16. | |
// Copyright © 2016 Facebook. All rights reserved. | |
// | |
#import "LinkedinStorage.h" | |
#import <Foundation/Foundation.h> |