(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
swift_targets_map = { | |
"Charts" => "4.1" | |
} | |
post_install do |installer| | |
installer.pods_project.targets.each do |target| | |
target.build_configurations.each do |config| | |
version = swift_targets_map[target.name] | |
if version | |
puts "#{target} using Swift #{version}" |
// | |
// PlusOne.m | |
// test | |
// | |
// Created by Song Zhou on 08/05/2017. | |
// Copyright © 2017 Song Zhou. All rights reserved. | |
// | |
#import "PlusOne.h" |
<?PHP | |
require '/path/to/markdown-extra.php'; | |
$db = mysql_connect('localhost', 'root', 'password') or die(mysql_error()); | |
mysql_select_db('tylerio', $db) or die(mysql_error()); | |
$files = scandir('posts'); | |
array_shift($files); // . | |
array_shift($files); // .. |
private let pngHeader: [UInt8] = [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A] | |
private let jpgHeaderSOI: [UInt8] = [0xFF, 0xD8] | |
private let jpgHeaderIF: [UInt8] = [0xFF] | |
private let gifHeader: [UInt8] = [0x47, 0x49, 0x46] | |
// MARK: - Image format | |
enum ImageFormat { | |
case Unknown, PNG, JPEG, GIF | |
} |
#import <CommonCrypto/CommonCrypto.h> | |
@interface NSString (md5) | |
- (NSString *)md5; | |
@end | |
@implementation NSString (md5) | |
- (NSString *)md5 |
#!/bin/bash | |
# before commit, run this script will set build number to recent SVN revision number | |
# run this script in project directory | |
echo "Update build number" | |
echo "get revision number from SVN..." | |
svn_info=$(svn info -r 'HEAD') | |
if [[ $? != 0 ]]; then | |
exit $? | |
fi |
// | |
// CLLocation+Sino.h | |
// | |
// Created by [email protected] on 13-4-26. | |
// 火星坐标系转换扩展 | |
// | |
// earth(国外 WGS84), mars(国内 GCJ-02), bearPaw(百度 BD-09) 坐标系间相互转换 | |
// 未包含 mars2earth. 需要这个可参考 http://xcodev.com/131.html | |
#import <CoreLocation/CoreLocation.h> |
void Swizzle(Class c, SEL orig, SEL new) { | |
Method origMethod = class_getInstanceMethod(c, orig); | |
Method newMethod = class_getInstanceMethod(c, new); | |
if (class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))){ | |
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); | |
} else { | |
method_exchangeImplementations(origMethod, newMethod); | |
} | |
} |
static const int target_key; | |
@implementation UIGestureRecognizer (Block) | |
+(instancetype)nvm_gestureRecognizerWithActionBlock:(NVMGestureBlock)block { | |
return [[self alloc]initWithActionBlock:block]; | |
} | |
- (instancetype)initWithActionBlock:(NVMGestureBlock)block { | |
self = [self init]; | |
[self addActionBlock:block]; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.