Skip to content

Instantly share code, notes, and snippets.

@chosa91
chosa91 / Breakpoints_v2.xcbkptlist
Created January 23, 2017 11:22 — forked from Ashton-W/Breakpoints_v2.xcbkptlist
My User Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
@chosa91
chosa91 / Channel.swift
Last active March 30, 2018 17:56 — forked from gokselkoksal/Channel.swift
Channel implementation
public class Channel<Value> {
private class Subscription {
weak var object: AnyObject?
private let notifyBlock: (Value) -> Void
private let queue: DispatchQueue
var isValid: Bool {
return object != nil
}
@chosa91
chosa91 / Scheduling-AppDelegate.swift
Created May 18, 2018 13:09 — forked from shaps80/Scheduling-AppDelegate.swift
NSNotification Scheduling Service in Swift. (the only required file is `SchedulingService.swift`)
//
// AppDelegate.swift
// Scheduling
//
// Created by Shaps Benkau on 19/02/2018.
// Copyright © 2018 152percent Ltd. All rights reserved.
//
import UIKit
@chosa91
chosa91 / KeyboardSizedView.m
Last active May 18, 2018 13:54
KeyboardSizedView
//
// Rewrited from Swift to obj-c
// Original source: https://github.com/objcio/app-architecture/blob/master/One-App-Eight-Architectures/MultiPattern/KeyboardSizedView.swift
//
@interface KeyboardSizedView ()
@property (nonatomic, strong) NSLayoutConstraint *keyboardConstraint;
@end
// # Challenge2
struct TestCase {
let nums: [Int]
let expectation: Int
}
let test1 = [3, 1, 2, 3] // => output: 9 | ok
/**
3, 3 => 3
@chosa91
chosa91 / XCUIApplication+Scrolling.swift
Created October 4, 2019 08:22 — forked from ryanmeisters/XCUIApplication+Scrolling.swift
Scrolling helpers automated ui tests using XCUIApplication
extension XCUIApplication {
private struct Constants {
// Half way accross the screen and 10% from top
static let topOffset = CGVector(dx: 0.5, dy: 0.1)
// Half way accross the screen and 90% from top
static let bottomOffset = CGVector(dx: 0.5, dy: 0.9)
}
var screenTopCoordinate: XCUICoordinate {
@chosa91
chosa91 / sources.md
Last active October 11, 2019 10:44
[INST][HW] Snapshot testing.md
import Foundation
public enum Method: String {
case GET
case POST
case PUT
case PATCH
case DELETE
}
@chosa91
chosa91 / DynamicUserDefaults.swift
Created November 15, 2019 10:50 — forked from marty-suzuki/DynamicUserDefaults.swift
Sample usage of Swift 5.1 dynamicMemberLookup that supports KeyPath.
import Foundation
@dynamicMemberLookup
final class DynamicUserDefaults {
static var standard: DynamicUserDefaults {
return DynamicUserDefaults(.standard)
}
private let keys = Keys()
@chosa91
chosa91 / KeyboardScrollView.swift
Created December 2, 2019 05:56 — forked from douglashill/KeyboardScrollView.swift
A UIScrollView subclass that allows scrolling using a hardware keyboard like NSScrollView. Supports arrow keys, option + arrow keys, command + arrow keys, space bar, page up, page down, home and end.
// Douglas Hill, November 2019
import UIKit
/// A scroll view that allows scrolling using a hardware keyboard like `NSScrollView`.
/// Supports arrow keys, option + arrow keys, command + arrow keys, space bar, page up, page down, home and end.
/// Limitations:
/// - Paging scroll views (isPagingEnabled = true) are not supported yet.
/// - The scroll view must become its own delegate so setting the delegate is not supported yet.
/// - Does not consider zooming. This has not been tested at all.