Skip to content

Instantly share code, notes, and snippets.

View x0000ff's full-sized avatar

Konstantin Portnov x0000ff

View GitHub Profile
@x0000ff
x0000ff / UserModel.h
Last active March 27, 2017 20:59
Implementation of `isEqual:` http://nshipster.com/equality/
@interface UserModel : NSObject
@property (copy, nonatomic) NSString *name;
@property (copy, nonatomic) NSNumber *age;
@end
@x0000ff
x0000ff / AsyncOperation.swift
Created June 11, 2017 02:12
AsyncOperation in Swift
import Foundation
open class AsyncOperation: Operation {
public enum State: String {
case Ready, Executing, Finished
fileprivate var keyPath: String {
return "is" + rawValue
}
@x0000ff
x0000ff / api-categories.json
Created August 25, 2017 14:32
api-categories.json for Yandex Money test app
[
{
"title": "Phone",
"subs": [
{
"id": 157291,
"title": "Cell Phone Service"
},
{
"id": 524624,
@x0000ff
x0000ff / nsstring-copy.md
Last active November 25, 2020 07:37
Should be NSString property being `copy` or `strong`?

Disclaimer

So, you have to use copy

Explain

If you have this property:

@property (strong) NSString *name;
@x0000ff
x0000ff / Disable App Transport Security for localhost.md
Last active December 23, 2018 02:05
App Transport Security :: Disable for localhost

If you see this error "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." in Xcode console:

load failed with error Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLStringKey=http://localhost/BLAH-BLAH-BLAH, NSErrorFailingURLKey=http://localhost:3000/brands, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <F7630F1E-0BA5-4EBC-9CDA-351A5842F84D>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F7630F1E-0BA5-4EBC-9CDA-351A5842F84D>.<1>, NSUnderlyingError=0x6000001a9860 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}} [-1022]
Error: The resource could not be loaded because the App Transport Security policy requires the use of a
@x0000ff
x0000ff / package.json
Created January 11, 2020 22:26
Start `React` app without opening url in browser
// React v.16.12.0
"scripts": {
"start": "export BROWSER=none; react-scripts start"
}

Configure Tests for Kotlin Project

Create project

  1. In IntelliJ Idea: File => New => Project

  2. Select type Gradle and in Additional LIbriries and Framworks select only Kotlin/JVM

    created

Add JUnit and Kotlin JUnit

@x0000ff
x0000ff / scrabble-tdd.md
Last active March 23, 2020 20:06
Scrabble TDD

(c) Exercism

TDD

Given a word, compute the scrabble score for that word.

Letter Values