[Carthage][carthage] 是一個較新的 Cocoa 開發第三方套件管理工具,相較於知名 [CocoaPods][cocoapods] 管理工具的複雜配置,輕巧的 Carthage 在推出之後廣受 Swift 社群喜愛。
本文基於 Carthage 0.20: Unary, Binary, Ternary
- 時代潮流:Written in Swift! (v.s. CocoaPods in Ruby)
- 主流現代:iOS 8+, dynamic framework only
#!/usr/bin/env Rscript | |
# | |
# ----- For NTU Forestry 3049 Course Only ----- | |
# | |
# Generate SpatialPointDataFrame based on dataset in Xitou | |
# | |
# This Gist: https://git.io/v6ozP | |
# | |
# Mail: [email protected] | |
# Author: Weihang Lo |
// import Dispatch | |
import Foundation | |
let semaphore = DispatchSemaphore(value: 0) | |
let group = DispatchGroup() | |
let globalQueue = DispatchQueue.global(qos: .default) | |
print("Tasks started!!!") | |
print() |
opt_in_rules: | |
- closure_end_indentation | |
- closure_spacing | |
- empty_count | |
- force_unwrapping | |
- missing_docs | |
- operator_usage_whitespace | |
- private_outlet | |
- redundant_nil_coalescing | |
- overridden_super_call |
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
from PIL import Image, ImageDraw | |
im = Image.open('img_original.png') | |
def interpolate(f_co, t_co, interval): | |
det_co =[(t - f) / interval for f , t in zip(f_co, t_co)] | |
for i in range(interval): |
所謂良好的使用者體驗,有個基本要求:「能即時回饋使用者的互動」。在 Mobile Native,常利用多線程(Multi-threading)分散主線程(main thread)的負擔,讓其能即時響應使用者點擊等事件。反觀 web 端的霸主 JavaScript,卻是易被阻塞的單線程(single-threaded)語言,不過藉由 Event Loop 的設計,仍可達成非同步操作,線程不至完全阻塞,或多或少彌補了單線程的不足。
眾所周知,[Concurrency is hard!][concurrency-joke]設計不良的非同步程式,絕對會讓你痛不欲生。本文將簡單介紹 Promise 這個現代 JavaScript Concurrency Features,讓 JS 新標準帶你從地獄回到另一個煉獄人間。
(撰於 2017-06-12,基於 ECMAScript 6+)
const blobURL = URL.createObjectURL(new Blob([ '(', | |
function () { | |
function fibonacci () {} | |
onmessage = function (ev) { | |
const result = processData(ev.data) | |
postMessage(result) | |
} | |
}.toString(), | |