Skip to content

Instantly share code, notes, and snippets.

@ole
ole / date-format-strings.swift
Last active October 8, 2020 04:25
Type-safe date format strings using string interpolation. Requires Swift 5.0.
// Type-safe date format strings using string interpolation
// Requires Swift 5.0.
import Foundation
enum DateFormatComponent {
case era(AlphaStyle)
case year(MinimumDigits)
case yearForWeekOfYear(MinimumDigits)
case quarter(AlphaNumericStyle)
@lattner
lattner / TaskConcurrencyManifesto.md
Last active July 29, 2024 06:06
Swift Concurrency Manifesto
@aciidgh
aciidgh / SwiftStack.swift
Created January 2, 2016 15:59
A generic stack in swift
protocol StackType {
typealias Element
mutating func push(element: Element)
mutating func pop() -> Element?
}
final class BufferStorage<Element> {
private var ptr: UnsafeMutablePointer<Element>
private let capacity: Int
@neilco
neilco / RSASHA1.swift
Created April 27, 2015 09:07
RSA-SHA1 signing with a PKCS#12 private key
//
// RSASHA1.swift
//
// Copyright (c) 2015 Neil Cowburn. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@xslim
xslim / UIAutomationAddon.js
Created February 22, 2011 22:00
UI Automation sample test file
/*
* Test
*/
function test(title, f, options) {
if (options == null) {
options = {
logTree: true
};
}