Skip to content

Instantly share code, notes, and snippets.

View Headmast's full-sized avatar

Kirill Klebanov Headmast

  • Agro.Club
  • Voronezh, Russia
View GitHub Profile
@yamaya
yamaya / xcode-swift-vers
Last active May 20, 2024 16:56
Xcode swift version record
# Xcode 6.2 (6C131e)
Swift version 1.1 (swift-600.0.57.4)
Target: x86_64-apple-darwin14.1.0
# Xcode 6.3 (6D570)
Apple Swift version 1.2 (swiftlang-602.0.49.3 clang-clang-602.0.49)
Target: x86_64-apple-darwin14.1.0
# Xcode 6.3.1 (6D1002)
Apple Swift version 1.2 (swiftlang-602.0.49.6 clang-602.0.49)
@staltz
staltz / introrx.md
Last active May 20, 2024 14:59
The introduction to Reactive Programming you've been missing
@zacwest
zacwest / ios-font-sizes.swift
Last active May 17, 2024 10:24
iOS default font sizes - also available on https://www.iosfontsizes.com
let styles: [UIFont.TextStyle] = [
// iOS 17
.extraLargeTitle, .extraLargeTitle2,
// iOS 11
.largeTitle,
// iOS 9
.title1, .title2, .title3, .callout,
// iOS 7
.headline, .subheadline, .body, .footnote, .caption1, .caption2,
]
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active May 10, 2024 15:05
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@khakimov
khakimov / gist:3558086
Created August 31, 2012 19:49
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@jls21
jls21 / How to run devices with new iOS version on old Xcode
Last active April 10, 2024 10:33
How to run devices with new iOS version on old Xcode
If you are having device with new iOS version(iOS 10.3 for example), but don't wanna to update XCode 8.2.1.
It's very simple to run application on new iOS with old XCode.
Check this out.
Follow the steps:
1. Download .dmg file with new XCode from apple developer portal (https://developer.apple.com/download/more/).
2. Keep your old XCode and unarchive new XCode from .dmg file.
3. Goto (New XCode path)/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport and copy folder with new iOS
4. Paste it to (Old XCode path)/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
//
// UIBarButtonItem+Badge.swift
// PiGuardMobile
//
// Created by Stefano Vettor on 12/04/16.
// Copyright © 2016 Stefano Vettor. All rights reserved.
//
import UIKit
@arturlector
arturlector / ios-questions-interview.md
Last active February 25, 2024 18:44
Вопросы на собеседование iOS разработчика.

Вопросы на собеседование iOS разработчика (дополненное издание):

General:

  • Что такое полиморфизм?

  • Что такое *инкапсуляция? Что такое *нарушение инкапсуляции?

  • Чем абстрактный класс отличается от интерфейса?

  • Расскажите о паттерне MVC. Чем отличается пассивная модель от активной?

@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@npu3pak
npu3pak / fix_twitter_warnings.sh
Last active August 20, 2023 16:39
This script fixes all TwitterKit related warnings in XCode 10.1. Add new run script build phase with this code:
readonly MODULEMAP="${PODS_ROOT}/TwitterCore/iOS/TwitterCore.framework/Modules/module.private.modulemap"
readonly HEADER="${PODS_ROOT}/TwitterCore/iOS/TwitterCore.framework/Headers/TwitterCore.h"
if ! grep -q "TwitterCore_Private" "${MODULEMAP}"; then
cat >"${MODULEMAP}" <<EOL
module TwitterCore_Private {
}
EOL
fi