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 | |
func isExactClass<T>(obj: Any, _ _: T.Type) -> Bool{ | |
return type(of: obj) == T.self | |
} | |
class Dog { | |
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 swizzleClassMethod(cls: AnyClass, oldSelector: Selector, newSelector: Selector) { | |
let oldMethod = class_getClassMethod(cls, oldSelector) | |
let newMethod = class_getClassMethod(cls, newSelector) | |
method_exchangeImplementations(oldMethod, newMethod) | |
// following code not work | |
// if(class_addMethod(cls, oldSelector, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) { | |
// class_replaceMethod(cls, newSelector, method_getImplementation(oldMethod), method_getTypeEncoding(oldMethod)) | |
// } 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
## UI Code Snippet | |
#### UILabel | |
``` | |
{ | |
UILabel* lb =[[UILabel alloc]initWithFrame:CGRectZero]; | |
lb.autoresizingMask=UIViewAutoresizingFlexibleWidth; |
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
package com.dogkk; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; |
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*)numberToChineseUppercase:(double)num{ | |
int iLen,iNum,iAddZero=0; | |
NSMutableString *szChMoney = [[NSMutableString alloc] init]; | |
NSArray *hzUnit = @[@"分",@"角",@"元",@"拾",@"佰",@"仟",@"万",@"拾",@"佰",@"仟",@"万",@"亿",@"拾",@"佰",@"仟",@"万",@"拾",@"佰",@"仟"]; | |
NSArray *hzNum = @[@"零",@"壹",@"贰",@"叁",@"肆",@"伍",@"陆",@"柒",@"捌",@"玖"]; | |
NSString *szNum = [NSString stringWithFormat:@"%18.0f",num*100]; | |
szNum = [szNum stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; | |
iLen =(int) szNum.length; | |
NewerOlder