Skip to content

Instantly share code, notes, and snippets.

原帖地址: http://topic.csdn.net/u/20110113/19/b0d5d506-4307-428b-a61d-7974aa66a2da.html
首先要说明的是:这里介绍的方法都是大部分是本人“悟”出来的,所以网上难有流传!
好方法不能自己私藏,否则就白忙乎这几天了,分享给有需要的朋友们。如果有转载,敬请注明来自*CSDN老邓*作品。
呵呵,给自己打广告,实在是无耻之极,权当无聊之时打字之用。
欢迎流传,为最优秀的分布式版本管理系统Git做宣传!!
步骤:
1. 下载:http://loaden.googlecode.com/files/gitconfig.7z
2. 解压到:<MsysGit安装目录>/cmd/,例如:D:\Program Files\Git\cmd
@yume190
yume190 / alertController.m
Last active August 29, 2015 14:02
UIAertController Usage
changeAlert = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert];
UIAlertController* __weak weakAlert = changeAlert;
UIAlertAction *alertActionOk = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
UITextField *t = [[weakAlert textFields] firstObject];
DLog(@"%@",t.text);
[weakAlert dismissViewControllerAnimated:YES completion:nil];
}];
UIAlertAction *alertActionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
DLog(@"%@",action);
// Label2.h
// (c) 2009 Ivan Misuno, www.cuberoom.biz
#import <UIKit/UIKit.h>
typedef enum
{
VerticalAlignmentTop = 0, // default
VerticalAlignmentMiddle,
VerticalAlignmentBottom,
// Label2.mm
// (c) 2009 Ivan Misuno, www.cuberoom.biz
#import "Label2.h"
@implementation Label2
-(id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
//
// VerticallyAlignedLabel.h
//
#import <Foundation/Foundation.h>
typedef enum VerticalAlignment {
VerticalAlignmentTop,
VerticalAlignmentMiddle,
//
// VerticallyAlignedLabel.m
//
#import "VerticallyAlignedLabel.h"
@implementation VerticallyAlignedLabel
@synthesize verticalAlignment = verticalAlignment_;
@yume190
yume190 / UsefulMacro.h
Last active August 29, 2015 14:03
Objetive-C useful Macro
//source : http://blog.csdn.net/yiya1989/article/details/7849588
#define myprintf(...) printk("[lch]:File:%s, Line:%d, Function:%s," \
__VA_ARGS__, __FILE__, __LINE__ ,__FUNCTION__);
//source : http://stackoverflow.com/questions/969130/how-to-print-out-the-method-name-and-line-number-and-conditionally-disable-nslog
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
# define DLog(...)
#endif
@yume190
yume190 / XARC.h
Created July 7, 2014 07:04
Who retain my text??
@interface XARC : NSObject
@property(nonatomic,strong) NSString* text;
@end
@implementation XARC
//-(NSString *)text{
// return _text;
//}
@end
@yume190
yume190 / StructTest.swift
Last active August 29, 2015 14:04
Swift Struct to NSData
protocol Constructible {
init()
}
struct devicePacketHeader{
var head:Byte = 1;
var checksum:Byte = 2;
var deviceID:Byte = 3;
var command:Byte = 4;
var len:Int16 = 5;
@yume190
yume190 / T12345.swift
Last active August 29, 2015 14:04
test1234
class packetFactory{
class func sender<T where T:Constructible, T:Packable>(command:devicePacketHeader.commandType,content:T) -> devicePacketSender<T>?{
var header:devicePacketHeader
switch (command,content){
case (.ASK_DEVICE,let TAsk) where TAsk is devicePacketNil:
header = devicePacketHeader(deviceID: .UNKNOWN, command: command, len:Int16(sizeof(T)))
// case (_,let TNil) where TNil is devicePacketNil:
// fallthrough