Skip to content

Instantly share code, notes, and snippets.

View rowwingman's full-sized avatar

Maksym Prokopchuk rowwingman

View GitHub Profile
@rowwingman
rowwingman / .gitignore
Last active August 29, 2015 14:08 — forked from adamgit/.gitignore
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.3
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
@rowwingman
rowwingman / MyCustomObject.h
Last active September 30, 2016 14:56
Implementing a Mutable Subclass in Objective-C
@interface MyCustomObject : NSObject <NSCopying, NSMutableCopying> {
@protected
// Declare ivar, all ivars are protected by default.
NSString *_content;
}
// Declare property "content" as readonly.
@property (nonatomic, copy, readonly) NSString *content;
//...
@rowwingman
rowwingman / Objective-C
Created July 19, 2016 13:55
Thread safe access to share data
private let syncQueue = dispatch_queue_create("com.onevcat.photoQueue", DISPATCH_QUEUE_CONCURRENT)
- (NSString*)someString {
__block NSString *localSomeString;
dispatch_sync(_syncQueue, ^{
localSomeString = _someString;
});
return localSomeString;
}
@rowwingman
rowwingman / gist:9fccb511d448a8adc06c9f34d145b914
Created August 14, 2016 19:42
Swift hackerrank std In Out
// http://codegists.com/code/hackerrank-swift-input/
import Foundation
//MARK: STDIN STDOUT
func readData() -> NSData {
return NSFileHandle.fileHandleWithStandardInput().availableData
}
func readString() -> String {
return String(data: readData(), encoding:NSUTF8StringEncoding)!.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
@rowwingman
rowwingman / ioslocaleidentifiers.csv
Created October 19, 2016 13:01 — forked from jacobbubu/ioslocaleidentifiers.csv
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@rowwingman
rowwingman / Commands list
Last active July 31, 2017 20:24
Setup Git workspace
1). move git-completion.bash file to your root directory (cd ~)
2). move git-prompt.sh file to your root directory (cd ~)
3). Setup .bash_profile
4). add sublime as text editor for git
// https://stackoverflow.com/questions/10892368/problems-using-subl-command-in-terminal-command-not-found-no-such-file-or
// Setup sublime command in terminal
// https://help.github.com/articles/associating-text-editors-with-git/
$ sudo rm /usr/local/bin/subl
$ sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
@rowwingman
rowwingman / Mutex.md
Created August 24, 2017 08:31 — forked from cpq/Mutex.md
What is a mutex and how does it work

What is a mutex and how does it work

Imagine a big office (your program), with many assets (shared resources) and many employees (threads). For example, all employees share one common resource - a toilet. They have agreed to use a label on a toilet's door (mutex).

When an employee wants to use the toilet he checks a label on a door (locks a mutex). If it is "engaged" he waits (blocks on a mutex), then when it is "free", he enters the toilet and changes the label to

@rowwingman
rowwingman / Environments
Created September 17, 2017 18:36
Python
// Create environment:
python3 -m venv env
// Run environment:
. env/bin/activate
// install package:
pip install name_of_package
// example
pip install requests
@rowwingman
rowwingman / .swiftlint.yml
Created December 27, 2017 16:26
SwiftLint with disabled all rules that are enabled by default
disabled_rules:
- block_based_kvo
- class_delegate_protocol
- closing_brace
- closure_parameter_position
- colon
- comma
- compiler_protocol_init
- control_statement
- cyclomatic_complexity