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 <Foundation/Foundation.h> | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
// insert code here... | |
NSLog(@"Hello, World!"); | |
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*)timeString | |
{ | |
NSDateFormatter *formatter; | |
NSString *dateString; | |
formatter = [[[NSDateFormatter alloc] init] autorelease]; | |
[formatter setDateFormat:@"dd-MM-yyyy HH:mm:ss"]; | |
dateString = [formatter stringFromDate:[NSDate date]]; | |
return dateString; |
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
+ (instancetype)sharedInstance | |
{ | |
static MyClass *sharedInstance = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedInstance = [[MyClass alloc] init]; | |
}); | |
return sharedInstance; | |
} |
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 *string = @"中华人民共和国万岁 万岁 万万岁"; | |
NSCountedSet *countedSet = [NSCountedSet new]; | |
[string enumerateSubstringsInRange:NSMakeRange(0, [string length]) | |
options:NSStringEnumerationByComposedCharacterSequences | NSStringEnumerationLocalized | |
usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop){ | |
_sumText++; | |
[countedSet addObject:substring]; | |
}]; |
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 BezierCurveMove(screenSize: CGSize, node: SKSpriteNode) { | |
let size = node.size | |
var cgpath = CGPathCreateMutable() | |
//random values | |
let xStart = Utility.randInRange(Int(size.width)...Int(screenSize.width-size.width)) | |
let xEnd = Utility.randInRange(Int(size.width)...Int(screenSize.width-size.width)) | |
//ControlPoint1 | |
let cp1X = Utility.randInRange(Int(size.width)...Int(screenSize.width-size.width)) |
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
# Change the ownership and permissions of "//usr//local" back to your user account! | |
sudo chown -R $(whoami):admin /usr/local |
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 <Foundation/Foundation.h> | |
@interface Utlity : NSObject | |
+ (NSString *)formatDaySuffixForDate:(NSDate *)date; | |
+ (NSString *)formatDayWithSuffixForDate:(NSDate *)date withWeekday:(BOOL)showWeekday; | |
@end | |
@implementation Utlity |
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
using System; | |
using NUnit.Framework; | |
namespace RomanTest | |
{ | |
public class RomanArabic | |
{ | |
public RomanArabic() { } | |
[TestCase("M", 1000)] |
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
/** | |
* Generate a mutable URLRequest with authorisation Token (if has) and User-Agent | |
* | |
* @param url NSURL object | |
* @param method GET, POST, PUT or DELETE | |
* @return NSMutableURLRequest object, can be modify (add more values) later. | |
*/ | |
- (NSMutableURLRequest *)requestUrl:(NSURL *)url method:(NSString *)method { | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url | |
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
import PlaygroundSupport | |
class WLCollectionCell: UICollectionViewCell { | |
required init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
OlderNewer