Skip to content

Instantly share code, notes, and snippets.

View sstadelman's full-sized avatar
🚀

Stan Stadelman sstadelman

🚀
View GitHub Profile
@sstadelman
sstadelman / gist:f29c983c14668e5767eb
Created June 5, 2014 23:16
block declaration pattern
NSDictionary* (^SetODataTypesInDictionary)(NSDictionary *dictionary) = ^NSDictionary* (NSDictionary *inputDict) {
NSMutableDictionary *mutableObj = [NSMutableDictionary dictionaryWithDictionary:inputDict];
NSArray *allKeys = [mutableObj allKeys];
[allKeys enumerateObjectsUsingBlock:^(NSString *key, NSUInteger idx, BOOL *stop) {
NSObject *propValue = [(id<SODataProperty>)[mutableObj objectForKey:key] value];
if ([propValue isKindOfClass:[NSDictionary class]]) {
@sstadelman
sstadelman / gist:1a68c514f1cdb94f829f
Created June 20, 2014 20:31
SDK 3.0 SP05 header & library search paths
HEADER_SEARCH_PATHS = (
"$(inherited)",
"/Applications/Xcode6-Beta2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
"$(PROJECT_DIR)/../../target/headers/$(BUILD_STYLE)-$(PLATFORM_NAME)/com.sap.smp.client.ios/XScriptParser",
"$(PROJECT_DIR)/../../target/headers/$(BUILD_STYLE)-$(PLATFORM_NAME)/com.sap.smp.client.ios/Supportability",
"$(PROJECT_DIR)/../../target/headers/$(BUILD_STYLE)-$(PLATFORM_NAME)/com.sap.smp.client.ios/ODataOnline",
"$(PROJECT_DIR)/../../target/headers/$(BUILD_STYLE)-$(PLATFORM_NAME)/com.sap.smp.client.ios/ODataAPI",
"$(PROJECT_DIR)/../../target/headers/$(BUILD_STYLE)-$(PLATFORM_NAME)/com.sap.smp.client.ios/HttpConversation",
"$(PROJECT_DIR)/../../target/headers/$(BUILD_STYLE)-$(PLATFORM_NAME)/com.sap.smp.client.ios/HttpConvAuthFlows",
"$(PROJECT_DIR)/../../target/headers/$(BUILD_STYLE)-$(PLATFORM_NAME)/com.sap.smp.client.ios/E2ETrace2",
@sstadelman
sstadelman / gist:4184c9d74406bbafeba8
Created June 20, 2014 20:41
SDK 3.0 SP05 app pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sap.smp.client.ios.samples</groupId>
<artifactId>ODataAPISamplesParent</artifactId>
<version>3.5.0-SNAPSHOT</version>
</parent>
@sstadelman
sstadelman / bridging header.h
Last active August 29, 2015 14:02
SDK 3.0 SP05 swift bridging header
#import "HttpConversationManager.h"
#import "UsernamePasswordProviderProtocol.h"
#import "CommonAuthenticationConfigurator.h"
#import "SODataRequestDelegate.h"
#import "SODataRequestParam.h"
#import "SODataRequestParamSingleDefault.h"
#import "SODataResponseSingle.h"
#import "SODataResponse.h"
#import "SODataPayload.h"
@sstadelman
sstadelman / gist:39d9348b8b8dad77ed76
Created July 31, 2014 22:58
Initialize CommonAuthenticationConfigurator with MAFNGDelegate logonConfigurator property
#pragma mark - MAFLogonNGDelegate implementation
-(void) logonFinishedWithError:(NSError*)anError {
if (!anError) {
/*
Initialize HTTPConversationManager, set with logon configurator
*/
self.httpConvManager = [[HttpConversationManager alloc] init];
[[self.logonManager logonConfigurator] configureManager:self.httpConvManager];
@sstadelman
sstadelman / gist:00bd9c42cff68ae2829e
Created August 15, 2014 23:53
SAML2 Configuration Provider implementation
-(void) initConversationManagerWithSAMLProvider {
CommonAuthenticationConfigurator* commonConfig = [[CommonAuthenticationConfigurator alloc] init];
[commonConfig addSAML2ConfigProvider:self];
HttpConversationManager* manager = [[HttpConversationManager alloc] init];
[commonConfig configureManager:manager];
}
@sstadelman
sstadelman / gist:478e411d276f252e4f29
Last active August 29, 2015 14:05
Example SAP Discovery Service config payload for SAML2
{
"host": "ciatjavahanamobile-x000003.neo.ondemand.com",
"port": 443,
"protocol": "https",
"auth": [
{
"type": "saml2.web.post",
"config": {
"saml2.web.post.authchallengeheader.name": "com.sap.cloud.security.login",
"saml2.web.post.finish.endpoint.uri": "/SAMLAuthLauncher",
@sstadelman
sstadelman / deleteEntity
Created September 4, 2014 17:48
Example of deleteEntity:withCompletion
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
id<SODataEntity> entity = self.sortedEntities[indexPath.row];
NSMutableArray *arr = [NSMutableArray arrayWithArray:self.sortedEntities];
[arr removeObjectAtIndex:indexPath.row];
self.sortedEntities = arr;
@sstadelman
sstadelman / gist:a28002980eae3411cd9f
Created September 4, 2014 21:43
NSNotification listen for kLogonFinished
[[NSNotificationCenter defaultCenter] addObserverForName:kLogonFinished object:nil queue:nil usingBlock:^(NSNotification *note) {
[[DataController shared] fetchTravelAgencies];
}];
@sstadelman
sstadelman / listen in viewWillAppear.m
Last active August 29, 2015 14:06
Add listeners in viewWillAppear
- (void)viewWillAppear:(BOOL)animated {
[[Model shared] addObserver:self
forKeyPath:@"travelAgencies"
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial)
context:NULL];
}
- (void)viewWillDisappear:(BOOL)animated {
[[Model shared] removeObserver:self
forKeyPath:@"travelAgencies"];