Skip to content

Instantly share code, notes, and snippets.

View Austinate's full-sized avatar

Ostap Austinate

View GitHub Profile
@Austinate
Austinate / Add Web Tab.py
Created January 14, 2016 16:08 — forked from omz/Add Web Tab.py
Insert a custom browser tab into Pythonista
# coding: utf-8
from objc_util import *
import console
import urllib
import dialogs
WKWebView = ObjCClass('WKWebView')
UIViewController = ObjCClass('UIViewController')
UIBarButtonItem = ObjCClass('UIBarButtonItem')
NSURLRequest = ObjCClass('NSURLRequest')
@Austinate
Austinate / Dropbox File Picker.py
Created January 14, 2016 16:10 — forked from omz/Dropbox File Picker.py
Dropbox File Picker.py
# IMPORTANT SETUP INSTRUCTIONS:
#
# 1. Go to http://www.dropbox.com/developers/apps (log in if necessary)
# 2. Select "Create App"
# 3. Select the following settings:
# * "Dropbox API app"
# * "Files and datastores"
# * "(No) My app needs access to files already on Dropbox"
# * "All file types"
# * (Choose any app name)
@Austinate
Austinate / ios-questions-interview.md
Created January 29, 2016 12:04 — forked from arturlector/ios-questions-interview.md
Вопросы на собеседование iOS разработчика.

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

General:

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

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

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

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

@Austinate
Austinate / wwdc16.md
Created July 25, 2016 15:04 — forked from mackuba/wwdc16.md
New stuff from WWDC 2016

Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.

If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.

If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).


OSX → macOS 10.12 Sierra

@Austinate
Austinate / ProtocolAssociatedType.swift
Created March 21, 2017 15:21 — forked from troystribling/ProtocolAssociatedType.swift
A swift protocol with associated type used as type parameter in generic function
protocol Thing {
typealias argType
func doit(val:argType) -> argType
}
class IntThing : Thing {
func doit(val: Int) -> Int {
return val + 1
}
}
@Austinate
Austinate / organize-photos.py
Created August 17, 2017 19:13 — forked from cliss/organize-photos.py
Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/ You can see more…
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
@Austinate
Austinate / Defaults.swift
Created October 28, 2017 17:25 — forked from sunshinejr/Defaults.swift
Using NSUserDefaults in Swift 4.
import Foundation
public let Defaults = UserDefaults.standard
open class DefaultsKeys {
fileprivate init() {}
}
open class DefaultsKey<ValueType>: DefaultsKeys {
public let _key: String
@Austinate
Austinate / JSONDecoder+DateFormatting.swift
Created December 20, 2017 16:36
JSON Decoder which uses NSISO8601Formatter (or any other custom)
extension JSONDecoder.DateDecodingStrategy {
static var iso8601Custom: JSONDecoder.DateDecodingStrategy {
return .custom { decoder in
let container = try decoder.singleValueContainer()
let string = try container.decode(String.self)
guard let date = DateFormatter.iso8601Mapping.date(from: string) else {
throw DecodingError.dataCorruptedError(in: container,
debugDescription: "Date is in invalid format")
}
return date

Keybase proof

I hereby claim:

  • I am austinate on github.
  • I am austinate (https://keybase.io/austinate) on keybase.
  • I have a public key ASAPmBx5jZz-oc3Tphwr6CxP3Sq8tUN1jSJryD90QuDEYAo

To claim this, I am signing this object:

@Austinate
Austinate / AutoLayoutHelpers.swift
Last active January 20, 2022 16:43 — forked from floriankugler/AutoLayoutHelpers.swift
Very simple key path based Auto Layout helpers
import UIKit
typealias ConstraintBuilder = (_ child: UIView, _ parent: UIView) -> NSLayoutConstraint
extension UIView {
func addSubview(_ child: UIView, constraints: [ConstraintBuilder]) {
addSubview(child)
child.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate(constraints.map { $0(child, self) })
}