Skip to content

Instantly share code, notes, and snippets.

View XuYanci's full-sized avatar
🏠
Working from ShenZhen

XuYanCi @许小易 XuYanci

🏠
Working from ShenZhen
View GitHub Profile
class APICaller {
var url:URL?
var method = HTTPMethods.get
var params:[String:String]?
enum HTTPMethods: String { // http methods
case get = "GET"
case post = "POST"
case put = "PUT"
@AmatsuZero
AmatsuZero / proxyStatus.swift
Created August 14, 2018 02:45
iOS端检查是否设置了代理
/// 是否设置了代理
///
/// - Returns: 代理设置情况
func getProxyStatus() -> Bool {
guard let proxySettings = CFNetworkCopySystemProxySettings()?.takeUnretainedValue(),
let url = URL(string: "https://www.baidu.com") else {
return false
}
let proxies = CFNetworkCopyProxiesForURL((url as CFURL), proxySettings).takeUnretainedValue() as NSArray
guard let settings = proxies.firstObject as? NSDictionary,
@alsibir
alsibir / # Vim Cheatsheet
Last active February 13, 2024 14:43
[.vim] vim #vim
# Vim Cheatsheet
>Disclaimer: This cheatsheet is summarized from personal experience and other online tutorials. It should not be considered as an official advice.
## Global
```bash
:help keyword # open help for keyword
:o file # open file
:saveas file # save file as
:close # close current pane
@ingconti
ingconti / QRImage.swift
Created June 8, 2019 12:12
QRCodeImage for iOS and OSX: allows to create a correct QR code without blur (ported from https://gist.github.com/snej/c210cc4cbfe8fd277186)
//
// QRImage.swift
// QRCodeSample
//
// Created by ing.conti on 08/06/2019.
// Copyright © 2019 ing.conti. All rights reserved.
//