Skip to content

Instantly share code, notes, and snippets.

View Austinate's full-sized avatar

Ostap Austinate

View GitHub Profile
@Austinate
Austinate / REMAP_M1_KEYS.MD
Created January 4, 2023 12:06 — forked from zats/REMAP_M1_KEYS.MD
Apple M1 MacBook Do Not Disturb Key remapping

Following is a sample of LaungAgent that remaps do not disturb key to Siri (I am using Type to Siri)

This is a lightweight solution not relying on external apps.

Setting up

  1. Create ~/Library/LaunchAgents/com.local.KeyRemapping.plist
  2. Edit it to have following content
private_lane :perform_tests_run do |options|
devices = options[:devices] || ['iPhone 13 (15.2)', 'iPhone 8 (12.4)']
scan(
scheme: options[:scheme],
devices: devices,
ensure_devices_found: true,
reset_simulator: true,
fail_build: !is_ci, # do not fail the lane since we want test results to be published
# disable scan output since we need to generate a JUnit report with trainer
# scan supports only xcpretty (doesn't work correctly with parallel test runs) and xcbeautfiy (doesn't generate neither JUnit nor HTML reports)
@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) })
}

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 / 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
@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 / 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 / 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 / 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 / ios-questions-interview.md
Created January 29, 2016 12:04 — forked from arturlector/ios-questions-interview.md
Вопросы на собеседование iOS разработчика.

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

General:

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

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

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

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