Skip to content

Instantly share code, notes, and snippets.

View Appletone's full-sized avatar
💻
Coding

Lin Chia Hua Appletone

💻
Coding
  • Taipei, Taiwan
View GitHub Profile

CKA 考試全攻略流程

前言

接下來分享,我如何一次通過考試,並且拿到90分

我是在去年 2020 Cyber Monday 特價的時候買的,連買多少錢都忘了,而且拖到快過期才去考 XD

考試是採用線上考試的方式,考生可以在家上網,找個安靜的空間就可以考試了(後面會詳細講。

@Appletone
Appletone / SwifyJSONExtension.swift
Created October 13, 2016 02:06
Magical enhanced SwiftyJSON with tree traversal
// Magical enhanced SwiftyJSON with tree traversal
/*
ex:
let a_b_c = JSONTree(root: demoJSON, keyPath: ["a", "b", "c"])
print(a_b_c.parentNode.parentNode["n"])
*/
struct JSONTree {
var root:JSON
var keyPath:[JSONSubscriptType]
@Appletone
Appletone / Array.swift
Created July 20, 2016 08:56
Array Next Element
extension Array where Element: Hashable {
func after(item: Element) -> Element? {
if let index = self.indexOf(item) where index + 1 < self.count {
return self[index + 1]
}
return nil
}
}
class MyManager {
private static let sharedInstance = MyManager()
class var sharedManager : MyManager {
return sharedInstance
}
}
var fetchedResultsProcessingOperations: [NSBlockOperation] = []
private func addFetchedResultsProcessingBlock(processingBlock:(Void)->Void) {
fetchedResultsProcessingOperations.append(NSBlockOperation(block: processingBlock))
}
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
switch type {
case .Insert:
@Appletone
Appletone / UIViewController+UIImagePickerController.swift
Last active January 13, 2016 08:32
Making UIViewController Image Pickerable
protocol ImagePickable {
var imagePicker:UIImagePickerController { get set }
func openPhotoLibrary()
}
var AssociatedObjectHandle: UInt8 = 0
extension UIViewController : ImagePickable, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
var imagePicker:UIImagePickerController {
get {
@Appletone
Appletone / protocols.md
Created January 13, 2016 07:32 — forked from rbobbins/protocols.md
Notes from "Protocol-Oriented Programming in Swift"

PS: If you liked this talk or like this concept, let's chat about iOS development at Stitch Fix! #shamelessplug

Protocol-Oriented Programming in Swift

Speaker: David Abrahams. (Tech lead for Swift standard library)

  • "Crusty" is an old-school programmer who doesn't trust IDE's, debuggers, programming fads. He's cynical, grumpy.

  • OOP has been around since the 1970's. It's not actually new.

  • Classes are Awesome

    • Encapsulation
    • Access control
// Fix for IOS 9 pop-over arrow anchor bug
// ---------------------------------------
// - IOS9 points pop-over arrows on the top left corner of the anchor view
// - It seems that the popover controller's sourceRect is not being set
// so, if it is empty CGRect(0,0,0,0), we simply set it to the source view's bounds
// which produces the same result as the IOS8 behaviour.
// - This method is to be called in the prepareForSegue method override of all
// view controllers that use a PopOver segue
//
// example use:
@Appletone
Appletone / NSManagedObject.swift
Created January 7, 2016 14:04
Create a new NSManagedObject with init method (Xcode 7.2 Swift 2.1 ) from: http://stackoverflow.com/a/33583941
extension NSManagedObject {
// Returns the unqualified class name, i.e. the last component.
// Can be overridden in a subclass.
class func entityName() -> String {
return String(self)
}
convenience init(context: NSManagedObjectContext) {
let eName = self.dynamicType.entityName()
@Appletone
Appletone / ViewController.swift
Last active March 17, 2016 16:43
評估你的 App 是否加入 Apple Watch 功能
//
// ViewController.swift
// WatchPairedExample
//
// Created by 張 景隆 on 2015/11/26.
// Copyright © 2015年 張 景隆. All rights reserved.
//
import UIKit
import WatchConnectivity