View gist:3315063
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
NSMutableArray *items = [[NSMutableArray alloc] init]; | |
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; | |
negativeSpacer.width = -10; | |
[items addObject:negativeSpacer]; | |
// add button here | |
// padding will be 10px less than default | |
[self.toolbar setItems:items animated:YES]; |
View screenBrightness
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
ASCScreenBrightnessDetector *brightnessDetector = | |
[ASCScreenBrightnessDetector new]; | |
brightnessDetector.delegate = self; | |
- (void)screenBrightnessDidChange:(CGFloat)brightness { | |
NSLog(@"Brightness is: %f", brightness); | |
} |
View gist:9000493
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
# Install Java | |
sudo add-apt-repository ppa:webupd8team/java -y | |
sudo apt-get update | |
sudo apt-get install oracle-java8-installer | |
# In case you don't have unzip, install it | |
sudo apt-get install unzip | |
# Download Baasbox | |
wget --content-disposition http://www.baasbox.com/download/baasbox-stable.zip |
View gist:9001197
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
# Assumes all commands are run as root | |
# Refresh repositories | |
yum update | |
# Install open JDK | |
yum install java-1.7.0-openjdk | |
# In case you don't have unzip and wget, install them | |
yum install unzip |
View importing BaasBox
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
#ifdef __OBJC__ | |
#import <UIKit/UIKit.h> | |
#import <Foundation/Foundation.h> | |
#import "BAAClient.h" | |
#endif |
View gist:9607776
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
[BaasBox setBaseURL:@"http://localhost:9000" | |
appCode:@"1234567890"]; |
View gist:9616544
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
- (void) createUser { | |
BAAClient *client = [BAAClient sharedClient]; | |
[client createUserWithUsername:@"cesare" | |
password:@"password" | |
completion:^(BOOL success, NSError *error) { | |
if (success) { | |
View gist:9616684
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
- (void) uploadFile { | |
NSURL *imgPath = [[NSBundle mainBundle] URLForResource:@"baasbox" withExtension:@"png"]; | |
NSString* stringPath = [imgPath absoluteString]; | |
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:stringPath]]; | |
BAAFile *myLocalFile = [[BAAFile alloc] initWithData:data]; | |
myLocalFile.contentType = @"image/png"; | |
[myLocalFile uploadFileWithPermissions:nil | |
completion:^(BAAFile *file, NSError *error) { |
View gist:9914064
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
#import <Availability.h> | |
#ifndef __IPHONE_5_0 | |
#warning "This project uses features only available in iOS SDK 5.0 and later." | |
#endif | |
#ifdef __OBJC__ | |
#import <UIKit/UIKit.h> | |
#import <Foundation/Foundation.h> | |
#import "BAAClient.h" // < added import statement |
View gist:9914207
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
@interface SMPost : BAAObject | |
...; | |
@end |
OlderNewer