Skip to content

Instantly share code, notes, and snippets.

View swift-doc-issue-158.html
<h1>Types</h1>
<ul>
<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
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
#!/bin/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
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
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 {
completion(nil)
} 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
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
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
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
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
mattt / undocumented-symbol-urls-2019-09-20.txt
Created Oct 19, 2019
Undocumented Apple API symbols according to nooverviewavailable.com (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.
"https://developer.apple.com/documentation/accelerate/vimagecvimageformat/chromasiting/3241430"
"https://developer.apple.com/documentation/accelerate/vdsp/dcttransformtype/3240713"
"https://developer.apple.com/documentation/accelerate/vdsp/dfttransformtype/3240728"
"https://developer.apple.com/documentation/accelerate/vimage/error/3241360"
"https://developer.apple.com/documentation/accelerate/quadrature/error/3240672"
"https://developer.apple.com/documentation/accelerate/vimagecvimageformat/format/3241442"
"https://developer.apple.com/documentation/accelerate/vdsp/fouriertransformdirection/3240744"
"https://developer.apple.com/documentation/accelerate/vdsp/integrationrule/3240753"
"https://developer.apple.com/documentation/accelerate/vimage/options/3241388"
You can’t perform that action at this time.