Skip to content

Instantly share code, notes, and snippets.

View jenhausu's full-sized avatar

Will Su jenhausu

View GitHub Profile
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active November 18, 2024 09:05
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@zer4tul
zer4tul / 提问的智慧.md
Last active October 8, 2024 12:16
Simplified Chinese edition of "How To Ask Questions The Smart Way"
@dddnuts
dddnuts / Fastfile
Created June 4, 2016 10:39
Build ipa from Unity project with fastlane
fastlane_version "1.94.0"
default_platform :ios
platform :ios do
desc "Run Unity Editor tests"
lane :test_unit do
unity(
run_editor_tests: true
)
@mosluce
mosluce / Example.swift
Last active January 14, 2017 04:41
對於常用的 WebAPI 呼叫方式進行擴充 URLSession
/// 範例中使用了 SVProgressHUD, SwiftyJSON
/// 另外 UIAlertController 有 extension
func request(_ path: String, method: HttpMethod = .get, parameters: [String: Any]? = nil, localizedStatus: String? = NSLocalizedString("資料處理中", comment: "呼叫API讀取狀態文字"), _ completion: @escaping (_ json: JSON) -> Void) {
// 顯示 ActivityIndicator
if let status = localizedStatus { SVProgressHUD.show(withStatus: status) }
// 待會使用 GCD 版本所以要 Dispatch 到其他 thread
DispatchQueue.global().async {
public extension MoyaProvider {
public func request(_ target: Target,
callbackQueue: DispatchQueue? = nil,
progress: ProgressBlock? = nil) -> Promise<Moya.Response> {
return Promise { [weak self] fulfill, reject in
self?.request(
target,
callbackQueue: callbackQueue,
progress: progress,
completion: self?.completion(for: fulfill, reject: reject) ?? {_ in }