Skip to content

Instantly share code, notes, and snippets.

View mosluce's full-sized avatar

mosluce mosluce

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<flights>
<flight>
<flight_id>{6A49933F-7FD3-44F1-9278-78E0509B41C0}</flight_id>
<airline_rcd>MM</airline_rcd>
<flight_number>1028</flight_number>
<origin_rcd>TPE</origin_rcd>
<destination_rcd>HND</destination_rcd>
<fare_id>{35C514B6-FFBB-49FC-96F7-1B25FCDA26CA}</fare_id>
<transit_airline_rcd />
@mosluce
mosluce / gist:a95a63e193f69cb9a5b7ab036f38e8bd
Created October 17, 2016 07:21
虎航查詢Form攔截到的input內容
radioRoundTrip : RoundTrip
radioOneWay : OneWay
promoCode :
selOriginPicker : 台北 (TPE)
selOrigin : TPE
selDestPicker : 東京(成田及羽田機場)
selDest : XX1
dateDepart : 18 Oct 2016
dateReturn : 22 Oct 2016
TT_TripKind : return
@mosluce
mosluce / ProtocolNotofication.swift
Created November 22, 2016 13:15 — forked from pofat/ProtocolNotofication.swift
Deal with notification with protocol-oriented programing in Swift
//: Playground - noun: a place where people can play
import UIKit
// This is for dmoe, you can use a generice type to limit your observer to an UIViewController for common usage.
protocol Notifiable {
var name: Notification.Name { get }
func observe(by observer: Any, withSelector selector: Selector, object: Any?)
func post(object: Any? ,userInfo: [AnyHashable: Any]?)
static func remove(observer: Any)
@mosluce
mosluce / BorderDesignable.swift
Last active April 12, 2020 11:32
Protocol Oriented 結合 UIView 及 IBDesignable+IBInspectable 練習
//
// BorderDesignable.swift
// Gotyou
//
// Created by 默司 on 2016/11/28.
// Copyright © 2016年 默司. All rights reserved.
//
import Foundation
import UIKit
//
// Deserializable.swift
// MapperDemo
//
// Created by 默司 on 2016/12/1.
// Copyright © 2016年 默司. All rights reserved.
//
import Foundation
import SwiftyJSON
@mosluce
mosluce / Example.swift
Last active December 1, 2016 14:53
Protocol Oriented 練習:Deserialize JSON and XML
import Foundation
struct User {
var username: String?
var password: String?
}
extension User {
init(_ node: NodeAccessable) {
self.username = node.child("username").string
@mosluce
mosluce / NSObject.swift
Last active March 1, 2020 11:51
超惰性 extension 大全 + 默司微調
//
// NSObject.swift
// QBDemo01
//
// Created by 默司 on 2016/12/2.
// Copyright © 2016年 默司. All rights reserved.
//
import Foundation
@mosluce
mosluce / PhotoCropperMaskView.swift
Created December 16, 2016 09:30
照片剪裁工具
//
// CropperView.swift
// Gotyou
//
// Created by 默司 on 2016/12/15.
// Copyright © 2016年 默司. All rights reserved.
//
import UIKit
// 就上面的案例重組一下
import UIKit
struct FilmFestival {
var Name: String = ""
var FormattedPrice: Int = 0
}
struct Ticketing {
var Name: String = ""
var FormattedPrice: Int = 0
func requestSync(_ path: String, method: HttpMethod = .get, parameters: [String: Any]? = nil, localizedStatus: String? = nil) -> JSON? {
var out: JSON?
let semaphore = DispatchSemaphore(value: 0)
self.request(_ path, method: method, parameters: parameters, localizedStatus: localizedStatus) { (json) in
out = json
semaphore.signal()
}