Skip to content

Instantly share code, notes, and snippets.

View kos9kus's full-sized avatar
😶‍🌫️
Always coding

Kos kos9kus

😶‍🌫️
Always coding
View GitHub Profile
@kos9kus
kos9kus / KKTypeDPI.h
Last active June 29, 2016 22:50
New types for UIDevice as extension to determine current type of device in Swift
typedef NS_ENUM(NSUInteger, KKOperationImageType) {
KKOperationImageTypeMDPI,
KKOperationImageTypeHDPI,
KKOperationImageTypeXHDPI,
KKOperationImageTypeXXHDPI
};
@kos9kus
kos9kus / CreatePredicateWIthRadius.m
Last active June 28, 2016 21:57
Create a predicate for LCLocation to determine a distance with specific radius
KKPosition KKPositionMake(double latitude, double longitude, double r) {
KKPosition p;
p.latitude = latitude;
p.longitude = longitude;
p.radius = r;
return p;
}
#define deg2rad(degrees) ((M_PI * degrees)/180)
@kos9kus
kos9kus / NSURLErrorDomain.h
Last active October 25, 2024 05:04
URL Loading System Error Codes
These values are returned as the error code property of an NSError object with the domain “NSURLErrorDomain”.
Declaration
SWIFT
var NSURLErrorUnknown: Int { get }
var NSURLErrorCancelled: Int { get }
var NSURLErrorBadURL: Int { get }
var NSURLErrorTimedOut: Int { get }
var NSURLErrorUnsupportedURL: Int { get }
var NSURLErrorCannotFindHost: Int { get }
@kos9kus
kos9kus / IDETextKeyBindingSet.plist
Created December 14, 2016 22:16
Xcode Keybindings with customized shortcut
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Cancellation</key>
<dict>
<key>Cancel</key>
<string>cancelOperation:</string>
</dict>
<key>Case Changes</key>
@kos9kus
kos9kus / gist:339cd5e8e80d05c571725240aaf43ddf
Created March 1, 2017 15:44
Git repository config convenience alias
[alias]
kksubmupdate = submodule update
kkcommitlastmsg = commit -a -c ORIG_HEAD
kkstatus = "!sh -c 'git fetch && git status' "
kkpull = "!sh -c 'git pull --rebase && git kksubmupdate' "
kkcommitall = commit -a
kkrebaseinteractive = rebase -i
kklogahead = "!sh -c 'var_branch_name=$(git name-rev --name-only HEAD) && git log origin/$var_branch_name..HEAD' "
kklogbehind = "!sh -c 'var_branch_name=$(git name-rev --name-only HEAD) && git log HEAD..origin/$var_branch_name' "
kkmovetodev = checkout "develop1"
@kos9kus
kos9kus / iOS-POP-Framework_aggregate.sh
Last active July 4, 2017 10:44
Aggregate POP Framework for iOS
# Merge Script
# http://code.hootsuite.com/an-introduction-to-creating-and-distributing-embedded-frameworks-in-ios/
# 1
# Set bash script to exit immediately if any commands fail.
set -e
# 2
# Mac OS X
*.DS_Store
# Xcode
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
UIVisualEffect *blurEffect;
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *visualEffectView;
visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
// visualEffectView - UIImageView
visualEffectView.frame = self.imageView.bounds;
//
// PutZerosToTheEnd.swift
// Test
//
// Created by KONSTANTIN KUSAINOV on 16/12/2018.
// Copyright © 2018 KONSTANTIN KUSAINOV. All rights reserved.
//
import Foundation
@kos9kus
kos9kus / LongestConsecutiveSequence.swift
Created January 19, 2019 19:57
Longest Consecutive Sequence
//
// LongestConsecutiveSequence.swift
// Test
//
// Created by KONSTANTIN KUSAINOV on 19/01/2019.
// Copyright © 2019 KONSTANTIN KUSAINOV. All rights reserved.
//
//Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
//