Skip to content

Instantly share code, notes, and snippets.

View ArchieR7's full-sized avatar
👨‍💻

Archie Chang ArchieR7

👨‍💻
View GitHub Profile
let notification = UILocalNotification()
notification.alertAction = "推播滑動的動作名稱"
notification.alertBody = "推播的內容"
notification.alertTitle = "推播的標題"
notification.soundName = UILocalNotificationDefaultSoundName
// 觸發條件以使用者的位置為主
let region = CLCircularRegion(center: center, radius: radius, identifier: ID)
// 可以設定當使用者進入或離開區域的時候,是否要跳出通知
region.notifyOnExit = false
region.notifyOnEntry = true
@ArchieR7
ArchieR7 / requirements.txt
Created June 27, 2017 08:20
https://www.archie.tw/apns python APNs pusher requirements
cryptography
pyjwt
hyper
from apns import ApnsPusher
ApnsPusher().push("Test Title", "Test Body", "device token", False)
func applePay() {
let request = PKPaymentRequest()
request.merchantIdentifier = "merchant.tw.archie"
request.merchantCapabilities = .capability3DS
request.countryCode = "US"
request.currencyCode = "USD"
request.supportedNetworks = [.visa]
request.paymentSummaryItems = [PKPaymentSummaryItem.init(label: "Archie's shake hand", amount: 2000, type: .final)]
request.shippingType = .storePickup
let contact = PKContact()
func paymentAuthorizationViewControllerDidFinish(_ controller: PKPaymentAuthorizationViewController) {
}
func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Swift.Void) {
}
func paymentAuthorizationViewControllerWillAuthorizePayment(_ controller: PKPaymentAuthorizationViewController) {
if a == 1 {
print("a 等於 1")
} else {
print("a 不等於 1")
}
public func ALogDebug(_ string: Any, file: String = #file, line: Int = #line) {
print("📒 \(file.components(separatedBy: "/").last ?? "")[\(line)]: \(string)")
}
public func ALogWarn(_ string: Any, file: String = #file, line: Int = #line) {
print("⚠️ \(file.components(separatedBy: "/").last ?? "")[\(line)]: \(string)")
}
public func ALogInfo(_ string: Any, file: String = #file, line: Int = #line) {
print("ℹ️ \(file.components(separatedBy: "/").last ?? "")[\(line)]: \(string)")
Host github.com-Apple
HostName github.com
User git
IdentityFile ~/.ssh/Archie_Apple
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/github
import CocoaAsyncSocket
let socket = GCDAsyncSocket(delegate: <#T##GCDAsyncSocketDelegate?#>, delegateQueue: <#T##DispatchQueue?#>)
do {
try socket.connect(toHost: Host, onPort: Port)
} catch {
print(error)
}
// GCDAsyncSocketDelegate
//
// RxCocoaAsyncSocket.swift
//
// Created by 家齊 on 2017/7/14.
// Copyright © 2017年 張家齊. All rights reserved.
//
import Foundation
import RxSwift
import RxCocoa