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 Cocoa | |
import Foundation | |
class Block { | |
var index: Int = 0 | |
var dateCreated: String | |
var previousHash: String! | |
var hash: String! | |
var nonce: Int | |
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
// | |
// ReviewRequest.swift | |
// | |
// Created by 张嘉夫 on 12/8/17. | |
// Copyright © 2017 张嘉夫. All rights reserved. | |
import Foundation | |
import StoreKit | |
let runIncrementerSetting = "numberOfRuns" // 用于存储运行次数的 UserDefauls 字典键 |
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
var str = "str.str" | |
if let dotRange = str.range(of: ".") { | |
str.removeSubrange(dotRange.lowerBound..<str.endIndex) | |
} |
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
// | |
// CoreDataStack.swift | |
// ChineseNewWords | |
// | |
// Created by 张嘉夫 on 06/11/2017. | |
// Copyright © 2017 张嘉夫. All rights reserved. | |
// | |
import Foundation | |
import CoreData |
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
/* myArray is a NSMutableArray with some objects */ | |
NSUInteger count = [myArray count]; | |
for (NSUInteger i = 0; i < count; ++i) { | |
int nElements = count - i; | |
int n = (arc4random() % nElements) + i; | |
[myArray exchangeObjectAtIndex:i withObjectAtIndex:n]; | |
} |
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
override var prefersStatusBarHidden: Bool { | |
return true | |
} | |
override var supportedInterfaceOrientations: UIInterfaceOrientationMask { | |
return [UIInterfaceOrientationMask.portrait, UIInterfaceOrientationMask.portraitUpsideDown] | |
} |
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
DispatchQueue.main.async { | |
self.imageView.image = image | |
} |
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
NSSortDescriptor * descriptor = [[NSSortDescriptor alloc] initWithKey:@"interest" ascending:YES]; | |
stories = [stories sortedArrayUsingDescriptors:@[descriptor]]; | |
recent = [stories copy]; |
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
- (void)initSearchBar | |
{ | |
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)]; | |
[searchBar sizeToFit]; | |
searchBar.placeholder = [IFI18nUtils getLocalizedString:@"SEARCH"]; | |
searchBar.delegate = self; | |
searchBar.backgroundColor = [UIColor clearColor]; | |
[self.collectionView setContentInset:UIEdgeInsetsMake(-44, 0, 0, 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
- (void)initSearchBar | |
{ | |
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)]; | |
[searchBar sizeToFit]; | |
searchBar.placeholder = [IFI18nUtils getLocalizedString:@"SEARCH"]; | |
searchBar.delegate = self; | |
searchBar.backgroundColor = [UIColor clearColor]; | |
[self.collectionView setContentInset:UIEdgeInsetsMake(-44, 0, 0, 0)]; | |
} |
NewerOlder