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
func awakeFromNib() { | |
super.awakeFromNib() | |
self.titleLabel.reactive.text <~ self.viewModel.map { $0?.title } | |
self.label.reactive.text <~ self.viewModel.map { $0?.text } | |
self.imageView.reactive.image <~ self.viewModel.producer.flatMap(.latest) { | |
downloadImage($0.imageUrl).map(Optional.some).prefix(value: nil) | |
} | |
} |
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
final class ProductTableViewCell: UITableViewCell { | |
@IBOutlet var label: UILabel! | |
@IBOutlet var imageView: UIImageView! | |
@IBOutlet var titleLabel: UILabel! | |
let viewModel: MutableProperty<Product?> | |
var disposable: Disposable? | |
deinit() { |
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
// View Model layer | |
final class Product { | |
let title: String | |
let text: String | |
let imageUrl: URL | |
// ... | |
} | |
// Networking layer | |
func downloadImage(url: URL) -> SignalProducer<UIImage, NSError> { |
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
_adjustDoubleHeightTextVisibility | |
_backgroundFrameForAttributes: | |
_backgroundView | |
_beginDisablingRasterizationForReason: | |
_clearOverrideHeight | |
_crossfadeToNewBackgroundView | |
_crossfadeToNewForegroundViewWithAlpha: | |
_currentComposedData | |
_currentComposedDataForStyle: | |
_currentStyleAttributes |
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/python | |
import re | |
import sys | |
import codecs | |
generated_regex = re.compile(r"/\*(?P<comment>.*?)\*/[\n\r]*\"(?P<key>.*?)\"\s*=\s*\"(?P<value>.*?)\";", re.S) | |
handcrafted_regex = re.compile(r"\"(?P<key>.*?)\"\s*=\s*\"(?P<value>.*?)\";(?P<comment>)", re.S) | |
def parse(file_name, regex, encoding = "utf-8"): |
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/python | |
# HOW TO USE THIS SCRIPT: | |
# 0. Install [Day One CLI](http://dayoneapp.com/tools/) | |
# 1. Get your XML files using [Live Journal's export form](http://www.livejournal.com/export.bml) | |
# 2. Run this script against every exported file (yes, you get tons of XML files — it's a good idea to automate this step). The shell command should look like this | |
# `ls -1 *.xml | xargs -n1 lj-to-dayone -u username` | |
# assuming you have all your XMLs in current directory and lj-to-dayone on your PATH (or in the same directory). | |
# Author: Leonty Deriglazov, 14/07/2013. |
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
// | |
// UIDeviceHardware.h | |
// | |
// Used to determine EXACT version of device software is running on. | |
#import <Foundation/Foundation.h> | |
@interface UIDeviceHardware : NSObject | |
+ (NSString *) platform; |
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
.DS_Store | |
.svn | |
*.mode1v3 | |
*.pbxuser | |
project.xcworkspace |
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
export LC_CTYPE=en_US.UTF-8 | |
export PATH=$PATH:~/scripts:/opt/local/bin:/Developer/usr/bin:/usr/local/texlive/2009/bin/universal-darwin:/usr/local/git/bin/ | |
export EDITOR='mate -w' | |
export GIT_EDITOR="mate -wl1" | |
export LESSEDIT='mate -l %lm %f' | |
PS1="%n@%m:%20~%#> " | |
autoload -U compinit | |
compinit | |
zstyle ':completion:*:descriptions' format '%U%B%d%b%u' | |
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b' |
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
NSString * path = [[NSBundle mainBundle] pathForResource:<#Resource name#> ofType:@"plist"]; | |
NSData * plistXML = [[NSFileManager defaultManager] contentsAtPath: path]; | |
NSString * errorDesc = nil; | |
NSPropertyListFormat format; | |
<#Variable name#> = (<#Type of top level element#> *)[NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&errorDesc]; | |
if (nil == <#Variable name#>) { | |
NSLog(@"Can not load <#What#>."); | |
if (errorDesc) { | |
NSLog(@"Error description: %@", errorDesc); | |
[errorDesc release]; errorDesc = nil; |
NewerOlder