Skip to content

Instantly share code, notes, and snippets.

# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)

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

Полиморфизм — возможность объектов с одинаковой спецификацией иметь различную реализацию. Пример: Класс или интерфейс геометрических фигур (эллипс, многоугольник) может иметь методы для геометрических трансформаций (вычисление площади, смещение, поворот, масштабирование).

инкапсуляция - языковой механизм ограничения доступа к определённым компонентам объекта

//
// NSView+UserIteraction.h
// sources_for_indexing
//
// Created by Andrii Tischenko on 11/9/16.
//
//
#import <Cocoa/Cocoa.h>
@andriitishchenko
andriitishchenko / run opendiff
Created January 31, 2017 13:57
AppleScript for running opendiff tool with selected files in Finder
on run {input, parameters}
set selected_items to {}
tell application "Finder"
set selected_items to selection as alias list
if (count of selected_items) is not 2 then return
set file1 to POSIX path of (item 1 of selected_items)
set file2 to POSIX path of (item 2 of selected_items)
end tell
try
Variable Example
PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
LANG en_US.US-ASCII
IPHONEOS_DEPLOYMENT_TARGET 4.1
ACTION build
AD_HOC_CODE_SIGNING_ALLOWED NO
ALTERNATE_GROUP staff
ALTERNATE_MODE u+w,go-w,a+rX
ALTERNATE_OWNER username
ALWAYS_SEARCH_USER_PATHS YES
@andriitishchenko
andriitishchenko / prntscr.sh
Created May 19, 2017 10:16
osx script for continuously screen capturing with timeout 10s
#!/bin/sh
if [[ "$OSTYPE" != "darwin"* ]]; then
echo "This script for osx!"
exit
else
echo "Use CTRL+C to terminate"
fi
###############
spinner() {
local i sp n
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
// http://www.html5rocks.com/en/tutorials/es6/promises/
function get(url) {
// Return a new promise.
return new Promise(function(resolve, reject) {
// Do the usual XHR stuff
var req = new XMLHttpRequest();
req.open('GET', url);
req.onload = function() {
@andriitishchenko
andriitishchenko / openssl_commands.md
Created May 18, 2018 11:55 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@andriitishchenko
andriitishchenko / NSInvocation VS objc_msgSend
Last active July 3, 2018 13:43
NSInvocation VS objc_msgSend
Lets call the method:
- (void)document:(BAPreviewDocument*) doc shouldClose:(BOOL) shouldClose contextInfo:(void*) contextInfo;
Example of using NSInvocation
BOOL boolValue = YES;
NSMethodSignature * methodSig = [[delegate class] instanceMethodSignatureForSelector: shouldCloseSelector];
NSInvocation * invocation = [NSInvocation invocationWithMethodSignature:methodSig];
[invocation setTarget: delegate];
[invocation setSelector: shouldCloseSelector];
[invocation setArgument: &self atIndex: 2];