Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Mattt mattt

I may be slow to respond.
View GitHub Profile
View swift-doc-issue-158.html
<li><a href="./DeclarationCollector">DeclarationCollector</a>:​
A Swift syntax visitor that collects declarations.</li>
<li><a href="./AssociatedType">AssociatedType</a>:​
An associated type declaration.</li>
<li><a href="./Class">Class</a>:​
A class declaration.</li>
<li><a href="./ConditionalCompilationBlock">ConditionalCompilationBlock</a>:​
A conditional compilation block declaration.</li>
mattt / registry.bash
Created Jun 18, 2020
An example of how Git can be used as a transparent log for a package registry
View registry.bash
set -o errexit
set -o pipefail
set -o nounset
# Returns the SHA-256 checksum of a string or file
function checksum() {
if [ -f "$1" ]; then
shasum -a 256 "$1" | cut -d ' ' -f1
mattt / Rakefile
Last active Jun 10, 2020
A benchmark comparing various methods of downloading popular Swift packages
View Rakefile
require 'benchmark'
require 'tmpdir'
require 'json'
include Benchmark
namespace :benchmark do
task all: %i[full_clone shallow_clone curl_unzip]
task full_clone: ['packages.json'] do
mattt / CTExposureDetectionSession+Extensions.swift
Last active Apr 27, 2020
Theoretical convenience API for working with Apple's ContactTracing framework
View CTExposureDetectionSession+Extensions.swift
import ContactTracing
extension CTExposureDetectionSession {
func addPositiveDiagnosisKeys(batching keys: [CTDailyTracingKey], completion: CTErrorHandler) {
if keys.isEmpty {
} else {
let cursor = keys.index(keys.startIndex, offsetBy: maxKeyCount, limitedBy: keys.endIndex) ?? keys.endIndex
let batch = Array(keys.prefix(upTo: cursor))
let remaining = Array(keys.suffix(from: cursor))
mattt / cc.css
Last active Apr 9, 2020
Creative Commons Symbols @font-face CSS
View cc.css
@font-face {
font-family: "Creative Commons Symbols";
src: url(font_path("CreativeCommonsSymbols.woff2")) format("woff2"),
url(font_path("CreativeCommonsSymbols.woff")) format("woff");
font-weight: normal;
font-style: normal;
unicode-range: U+1F10D-1F10F, U+1F16D-1F16F;
i {
View localizedCurrencySymbol.swift
import Foundation
extension Locale {
func localizedCurrencySymbol(forCurrencyCode currencyCode: String) -> String? {
guard let languageCode = languageCode, let regionCode = regionCode else { return nil }
Each currency can have a symbol ($, £, ¥),
but those symbols may be shared with other currencies.
For example, in Canadian and American locales,
mattt / main.swift
Last active Jun 11, 2020
NaturalLanguage Framework - NLTagger Language Support Matrix
View main.swift
import NaturalLanguage
let languages: [NLLanguage] = [
.amharic, .arabic, .armenian, .bengali, .bulgarian,
.burmese, .catalan, .cherokee, .croatian, .czech,
.danish, .dutch, .english, .finnish, .french,
.georgian, .german, .greek, .gujarati, .hebrew,
.hindi, .hungarian, .icelandic, .indonesian, .italian,
.japanese, .kannada, .khmer, .korean, .lao,
.malay, .malayalam, .marathi, .mongolian, .norwegian,
mattt / swift-802.0.31.3.json
Last active Dec 9, 2019
Early Swift Doc output JSON for Swift standard library
View swift-802.0.31.3.json
This file has been truncated, but you can view the full file.
"files" : [
"enumerations" : [
"documentation" : [],
"declaration" : {
"attributes" : [],
"modifiers" : [
mattt / Alamofire.json
Last active Apr 9, 2020
Extremely early proof-of-concept Markdown document generation output for swift-doc
View Alamofire.json
"/Users/mattt/Desktop/Alamofire.swift" : {
"deinitializers" : [],
"functions" : [
"declaration" : {
"name" : "request",
"genericRequirements" : [],
"signature" : {
"output" : "DataRequest",
mattt / undocumented-symbol-urls-2019-09-20.txt
Created Oct 19, 2019
Undocumented Apple API symbols according to (as of 2019-09-20)
View undocumented-symbol-urls-2019-09-20.txt
This file has been truncated, but you can view the full file.
You can’t perform that action at this time.