This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL="https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash" | |
PROFILE="$HOME/.profile" | |
echo "Downloading git-completion..." | |
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then | |
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Alamofire 4 - Simple with URL request | |
Alamofire.upload(fileURL, with: urlRequest).validate().responseData { response in | |
debugPrint(response) | |
} | |
/**************************************************************************************************************/ | |
// Alamofire 4 - - Complex with URL string | |
Alamofire.upload(fileURL, to: urlString, method: .put) | |
.uploadProgress(queue: DispatchQueue.global(qos: .utility)) { progress in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Alamofire 4 - Simple Download request | |
let destination = DownloadRequest.suggestedDownloadDestination() | |
Alamofire.download(urlString, to: destination).response { response in | |
print(response.request) | |
print(response.response) | |
print(response.temporaryURL) | |
print(response.destinationURL) | |
print(response.error) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// StudyAlamofire | |
// | |
// Created by Kimi Peng on 2018/9/17. | |
// Copyright © 2018年 Kimi Peng. All rights reserved. | |
// | |
import UIKit | |
import Alamofire |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fileprivate func addRefreshControl() { | |
refreshControl = UIRefreshControl() | |
refreshControl?.addTarget(self, action: #selector(AQITableViewController.refresh), for: .valueChanged) | |
if let refreshControl = refreshControl { | |
self.tableView.addSubview(refreshControl) | |
} | |
} | |
@objc func refresh(sender: AnyObject) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alamofire.request(urlString).response { response in // method defaults to `.get` | |
debugPrint(response) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct UVI: Codable { | |
var County: String | |
var PublishAgency: String | |
var PublishTime: String | |
var SiteName: String | |
var UVI: String | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func dismissKeyboard(_ sender: Any) { | |
calculateNumbers(calculatorSegControl) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 點擊空白處,收鍵盤並執行calculateNumbers | |
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { | |
self.view.endEditing(true) | |
calculateNumbers(calculatorSegControl) | |
} |
NewerOlder