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 React, { PropTypes } from 'react' | |
import {View, ListView, Text } from 'react-native' | |
export default class ScrollToBottomExample extends React.Component { | |
constructor (props) { | |
super(props) | |
// Set up our two placeholder values. | |
this.listHeight = 0 |
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
#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
# 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
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
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
# 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
# wo = work on | |
wo() { | |
code_dir=~/Dropbox # replace it with your development directory | |
cd $(find $code_dir -type d -maxdepth 3 | grep -i $* | grep -Ev Pods --max-count=1) | |
} |
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
#!/usr/bin/env ruby | |
# fix-xcode | |
# Mark Rickert <[email protected]> | |
# Symlinks all your old SDKs to Xcode.app every time it is updated. | |
# Create a directory called /SDKs and run this script. | |
# | |
# Each time you upgrade Xcode, run fix-xcode. |
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 StatesScreen < PM::TableScreen | |
title "States" | |
def will_appear | |
view.backgroundView = nil | |
view.backgroundColor = UIColor.redColor | |
end | |
def table_style |
NewerOlder