let inputInt = Int(readline()!)!
let arrayInt = readlin()!.characters.split { $0== " " }.map { Int(String($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
# Unity gitignore is from : https://github.com/github/gitignore/blob/master/Unity.gitignore | |
# Created by https://www.gitignore.io/api/osx | |
# Edit at https://www.gitignore.io/?templates=osx | |
### OSX ### | |
# General | |
.DS_Store | |
.AppleDouble | |
.LSOverride |
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
git rm -r --cached node_modules | |
git commit -m 'Remove the now ignored directory node_modules' | |
git push origin master |
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
// nice quick and dirty webserver | |
const http = require('http') | |
const port = process.env.PORT || 3000 | |
const server = http.createServer((req, res) => { | |
res.writeHead(200, { 'Content-Type': 'text/plain '}) | |
res.end('Hello world! this is a noob server') | |
}) |
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 | |
// async swift playground | |
import PlaygroundSupport | |
// https://min-api.cryptocompare.com/data/all/coinlist | |
let allCoinsPath = "/data/all/coinlist" | |
class CryptoApi { |
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
// brushing up on url components | |
// | |
class CryptoApi { | |
static let host = "min-api.cryptocompare.com" | |
static let allCoinsPath = "/data/all/coinlist" | |
var allCoinsUrl: URL? = { | |
var urlComponents = URLComponents() | |
urlComponents.scheme = "https" | |
urlComponents.host = CryptoApi.host |
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
// brushing up on url components | |
// | |
class CryptoApi { | |
static let host = "min-api.cryptocompare.com" | |
static let allCoinsPath = "/data/all/coinlist" | |
var allCoinsUrl: URL? = { | |
var urlComponents = URLComponents() | |
urlComponents.scheme = "https" | |
urlComponents.host = CryptoApi.host |
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
// https://stackoverflow.com/questions/23806751/strong-reference-to-a-weak-references-inside-blocks | |
__weak typeof(self) weakSelf = self; | |
void (^someBlock)(id) = ^(id data){ | |
if (weakSelf != nil) { | |
// last remaining strong reference released by another thread. | |
// weakSelf is now set to nil. | |
[myArray addObject:weakSelf]; | |
} | |
}); |
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
// https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html#//apple_ref/doc/uid/TP40011210-CH8-SW16 | |
@interface XYZBlockKeeper : NSObject | |
@property (copy) void (^block)(void); | |
@end | |
@implementation XYZBlockKeeper | |
- (void)configureBlock { | |
self.block = ^{ | |
[self doSomething]; // capturing a strong reference to self |
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
protocol RowPresentable { | |
var string: String { get } | |
// it conforms to both protocol + class | |
var rowVC: UIViewController & PanModalPresentable { get } | |
} |