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 { | |
NSString *original = @"a\nb"; | |
NSLog(@"%@", original); | |
NSMutableString *string = [NSMutableString stringWithString:original]; | |
NSRegularExpression *re = [NSRegularExpression regularExpressionWithPattern:@"\n+" options:0 error: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
function someFunc() { | |
// Indent | |
alert('this is a function'); | |
if (1) { | |
// Indent on each '{' | |
alert('2-level indentation'); | |
} | |
alert('function end'); | |
} |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
self.window.backgroundColor = [UIColor whiteColor]; | |
[self.window makeKeyAndVisible]; | |
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; | |
view.backgroundColor = [UIColor yellowColor]; | |
[self.window addSubview:view]; | |
void (^keyframe1)(void) = ^{ |
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
#define kFilePath [NSString stringWithFormat:@"%@/uuid.wuuid", kDocumentPath] | |
#import <Foundation/Foundation.h> | |
@interface WTuuid : NSObject | |
+ (NSString *)stringWithUUID; | |
@end |
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
''' | |
Created on Feb 11, 2012 | |
@author: sodas | |
''' | |
class Fraction (object): | |
def __init__(self, numerator, denominator): | |
self.numerator = numerator | |
if denominator == 0: |
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/env python3 | |
import sys | |
import csv | |
import plistlib | |
import os | |
csv_file = sys.argv[1] | |
with open(csv_file, 'r', encoding='utf-8') as f: | |
result = list(csv.DictReader(f)) |
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
DMAuthor *author1 = [DMAuthor authorWithFirstName:@"Jo" lastName:@"Walton"]; | |
DMAuthor *author2 = [DMAuthor authorWithFirstName:@"Connie" lastName:@"Willis"]; | |
DMAuthor *author3 = [DMAuthor authorWithFirstName:@"J.K." lastName:@"Rowling"]; | |
DMBook *book1 = [[DMBook alloc] initWithTitle:@"Among Others" subtitle:nil price:10.19 andAuthor:author1]; | |
DMBook *book2 = [[DMBook alloc] initWithTitle:@"Blackout" subtitle:nil price:11.68 andAuthor:author2]; | |
DMBook *book3 = [[DMBook alloc] initWithTitle:@"Harry Potter with Philisopher's Stone" subtitle:nil price:10.0f andAuthor:author3]; | |
DMBook *book4 = [[DMBook alloc] initWithTitle:@"Harry Potter with Chamber of Secrets" subtitle:nil price:12.0f andAuthor:author3]; | |
DMBook *book5 = [[DMBook alloc] initWithTitle:@"Harry Potter with Prisoner of Azkaban" subtitle:nil price:14.0f andAuthor:author3]; | |
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 BCObject : NSObject | |
+ (int(^)(int, int))magicFunction:(int)seed; | |
+ (BOOL(^)(id))lengthValidator:(NSUInteger)validLength; | |
@end | |
@implementation BCObject | |
+ (int(^)(int, int))magicFunction:(int)seed { |
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 ISStorage : NSObject | |
+ (ISStorage *)sharedStorage; | |
- (id)valueForKeyInInternalStorage:(NSString *)key; | |
- (void)setValue:(id)value forKeyInInternalStorage:(NSString *)key; | |
@end |
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 ISTimerStorage : NSObject | |
+ (ISTimerStorage *)sharedStorage; | |
- (id)valueForKeyInInternalStorage:(NSString *)key; | |
- (void)setValue:(id)value forKeyInInternalStorage:(NSString *)key; | |
@end |
OlderNewer