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
# Create a DigitalOcean Ubuntu 12.04.3x64 droplet. | |
# DO NOT USE 13.10. There's a known issue with Dokku | |
# https://github.com/progrium/dokku#requirements | |
# On the server, install dependencies and Dokku | |
apt-get update && apt-get upgrade -y | |
apt-get install -y software-properties-common python-software-properties | |
wget -qO- https://raw.github.com/progrium/dokku/v0.2.2/bootstrap.sh | sudo DOKKU_TAG=v0.2.2 bash | |
# Put the app's hostname into the Dokku VHOST file |
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
class BigDecimal | |
def to_s | |
self.stringValue | |
end | |
def to_f | |
self.floatValue | |
end | |
def to_i |
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
def purchase_single_product(identifier) | |
NSLog "Starting purchase process for #{identifier}." | |
@iap_helper = IAPHelper.new(NSSet.setWithArray([identifier])) | |
@iap_helper.cancelled = cancelled_transaction | |
@iap_helper.success = transaction_successful | |
@iap_helper.request_product_info do |success, products| | |
if success && products.is_a?(Array) && products.count == 1 | |
@iap_helper.buy_product(products.first) | |
else |
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
# Usage | |
# | |
[:true, :false].cartesian_power(2) {|l| p l.inspect } | |
# "[:true, :true]" | |
# "[:true, :false]" | |
# "[:false, :true]" | |
# "[:false, :false]" | |
# | |
[:true, :false].cartesian_power(3) {|l| p l.inspect } | |
# "[:true, :true, :true]" |
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 <UIKit/UIKit.h> | |
#import <MessageUI/MessageUI.h> | |
#import <MessageUI/MFMailComposeViewController.h> | |
@interface MailMan : NSObject <MFMailComposeViewControllerDelegate> { | |
} | |
@property (nonatomic) UIViewController *vc; | |
- (id)initWithParentVC:(UIViewController *)vc; |
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
# Requires BubbleWrap gem with 'bubble-wrap/camera' required. | |
module ImageCapture | |
# Usage: | |
# capture_image({}) do | |
# # @captured_image should be an instance of UIImage | |
# end | |
# | |
# Options: | |
# { | |
# allows_editing: true, |
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
[SSZipArchive unzipFileAtPath:(NSString *) | |
toDestination:(NSString *)destinationFolderPath]; |
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
imageView.image = [UIImage imageWithData: | |
[UIData dataWithContentsOfURL: | |
[NSURL urlWithString: | |
[NSString stringWithFormat:@"http://my.imageurl.com/imagepath/%@", imageName] | |
] | |
] | |
]; | |
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
[imageView setImageWithURL:(NSURL *)url]; |
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
NSDictionary *myJsonDict = [parser objectWithString:myJSONString]; |
OlderNewer