Skip to content

Instantly share code, notes, and snippets.

View fel-cesar's full-sized avatar
💻

Felipe Cesar fel-cesar

💻
View GitHub Profile
//Assuming already existing "@property (nonatomic) Dropbox* dropbox;"(DropBox,Box,,GoogleDrive,OneDrive...)
UIImage * image = imageSource;
NSData * pngImageData = UIImagePNGRepresentation(image); // loading data from some source. (PNG)
NSInputStream * inputStream = [NSInputStream inputStreamWithData:pngImageData];
[self.service uploadFileToPath:@"/mudkip.jpg" withStream:inputStream size:imageData.length overwrite:YES];
//This is the set up code for iOS
//By replacing "CRDropbox" in the lines below you can implement whatever Cloud Storage service you want.
//Example:
//[CRBox alloc]
//[CROneDrive alloc], etc...
self.dropbox = [[CRDropbox alloc] initWithClientId:@"dropboxKey"
clientSecret:@"dropboxSecret"
redirectUri:@"https://www.cloudrailauth.com/auth" //example
state:@"CRSTATE"];// anyStateString will do for iOS
######################
# Options
######################
REVEAL_ARCHIVE_IN_FINDER=false
FRAMEWORK_NAME="${PROJECT_NAME}"
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
@fel-cesar
fel-cesar / CRSwiftExample.swift
Created August 9, 2016 12:18
Example for cloudrail website
//let cloudStorage : CloudStorageProtocol = Box.init(clientId: "ClientID", clientSecret: "ClientSecret")
//let cloudStorage : CloudStorageProtocol = GoogleDrive.init(clientId: "ClientID", clientSecret: "ClientSecret")
//let cloudStorage : CloudStorageProtocol = OneDrive.init(clientId: "ClientID", clientSecret: "ClientSecret")
let cloudStorage : CloudStorageProtocol = Dropbox.init(clientId: "ClientID", clientSecret: "ClientSecret")
do{
let inputStream = try cloudStorage.createFolderWithPath("/My folder path")
} catch let error{
print("An error: \(error)")
}
#DONT PUSH PRODUCTS
Products/
Products/*
#Docs - Not uploading docs
docs/
docs/*
# COCOAPODS
@fel-cesar
fel-cesar / build.sh
Created September 12, 2016 14:59 — forked from fjcaetano/build.sh
Universal Framework Build Script
#!/bin/sh
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
@fel-cesar
fel-cesar / CSObjc.m
Last active October 21, 2016 10:10
Example CloudStorage Objective-C
// id<CRCloudStorageProtocol> cs = [[CROneDrive alloc] initWithClientId:@"[CLIENT]" clientSecret:@"[SECRET]"];
// id<CRCloudStorageProtocol> cs= [[CRGoogleDrive alloc] initWithClientId:@"[CLIENT]" clientSecret:@"[SECRET]"];
// id<CRCloudStorageProtocol> cs = [[CRBox alloc] initWithClientId:@"[CLIENT]" clientSecret:@"[SECRET]" ];
// id<CRCloudStorageProtocol> cs = [[CRDropbox alloc] initWithClientId:@"[CLIENT]" clientSecret:@"[SECRET]"];
id<CRCloudStorageProtocol> cs = [[CREgnyte alloc] initWithDomain:@"[DOMAIN]" clientId:@"[CLIENT]" clientSecret:@"" redirectUri:@"[SECRET]" state:@"ANY"];
NSString * path = [[NSBundle mainBundle] pathForResource:@"UserData" ofType:@"csv"];
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];
long fileSize = [fileAttributes fileSize];
@fel-cesar
fel-cesar / CSSwift.swift
Created October 21, 2016 10:52
Example CloudStorage Swift 3
//let cloudStorage : CloudStorageProtocol = Box.init(clientId: "ClientID", clientSecret: "ClientSecret")
//let cloudStorage : CloudStorageProtocol = GoogleDrive.init(clientId: "ClientID", clientSecret: "ClientSecret")
//let cloudStorage : CloudStorageProtocol = OneDrive.init(clientId: "ClientID", clientSecret: "ClientSecret")
//let cloudStorage : CloudStorageProtocol = Dropbox.init(clientId: "ClientID", clientSecret: "ClientSecret")
let cloudStorage : CloudStorageProtocol = Egnyte.init(domain: "DOMAIN", clientId: "[CLIENT]", clientSecret: "[SECRET]", redirectUri: "[REDIRECTURI]", state: "ANY")
let path = Bundle.main.path(forResource: "UserData", ofType: "csv")!
let fileAttributes = try! FileManager.default.attributesOfItem(atPath: path)
let fileSize: UInt64 = fileAttributes[FileAttributeKey.size] as! UInt64
@fel-cesar
fel-cesar / StripExceedingArchs.sh
Created October 26, 2016 12:42
Script to strip off the exceeding architechtures from dynamic frameworks in xcode, (just add the script to build phases)
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
// self.service = [[CRMicrosoftAzure alloc] initWithAccountName:@"[account_name]" accessKey:@"[access_key]"];
// self.service = [[CRAmazonS3 alloc] initWithAccessKeyId:@"[clientID]" secretAccessKey:@"[client_Secret]" region:@"[region]"];
// self.service = [[CRRackspace alloc] initWithUsername:@"[username]" apiKey:@"[api_key]" region:@"[region]"];
self.service = [[CRBackblaze alloc] initWithAccountID:@"[account_init]" appKey:@"[app_key]"];
CRBucket * bucket = [[CRBucket alloc] init];
bucket.name = @"[bucket_name]";
bucket.identifier = @"[bucket_id]";
NSData * data = //data source;