Skip to content

Instantly share code, notes, and snippets.

@mluisbrown
mluisbrown / FixBTSound.applescript
Last active June 8, 2023 19:02
AppleScript to set macOS audio input device to "Internal Microphone"
-- Sets your audio input source to "Internal Microphone"
-- Frequently needed if you use bluetooth headpohones and
-- run the Xcode iOS simulator, which will often set your
-- headphones to be the input device, resulting in a drastic
-- decrease in sound quality, and making it mono
tell application "System Preferences" to activate
tell application "System Preferences"
reveal anchor "input" of pane id "com.apple.preference.sound"
end tell
let xs = [1, 2, 3, 4, 5]
for (element, index) in zip(xs, xs.indices) {
if index == xs.startIndex {
print("START")
}
print(element)
if index == xs.index(before: xs.endIndex) {
@rxwei
rxwei / ad-manifesto.md
Last active November 9, 2023 09:58
First-Class Automatic Differentiation in Swift: A Manifesto
@SlaunchaMan
SlaunchaMan / runGYB.bash
Last active July 17, 2018 13:57
Bash script to run Gyb on the given input files or file lists.
GYB_PATH="${SRCROOT}/Vendor/gyb/gyb"
function gyb {
file=$1
if [ ${file: -4} == ".gyb" ]; then
"${GYB_PATH}" --line-directive '' -o "${file%.gyb}" "$file";
fi
}
if [ $SCRIPT_INPUT_FILE_COUNT -ne 0 ]; then
@milseman
milseman / Swift5StateOfString.md
Created January 10, 2018 19:49
State of String: ABI, Performance, Ergonomics, and You!

State of String: ABI, Performance, Ergonomics, and You!

Hello, I’ve been working on implementing, optimizing, and improving String in preparation for ABI stability, and I thought I’d share the current status of String in Swift 5 and some potential directions to go. This is the product of conversations with open source contributors and my colleagues on the Swift standard library team at Apple.

The primary area of focus is stabilizing String’s ABI, but we’d be remiss if we couldn’t also fit in performance and ergonomic improvements. String’s ergonomics in particular is one area where we think the status quo is woefully inadequate, and over half of this email is devoted to that topic. At the end, there’s a section about a community initiative that we hope can help users of String as well as guide future development.

(Note: I’m sending this to swift-dev because much of the contents revolve around implementation concerns. I’ll also cross-reference on swift-evolution and swift-users. See also the [StringManife

@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 7, 2024 09:05
Swift Concurrency Manifesto
@troyfontaine
troyfontaine / 1-setup.md
Last active May 3, 2024 10:52
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@lattner
lattner / async_swift_proposal.md
Last active April 21, 2024 09:43 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@alessaba
alessaba / PlaygroundsFrameworks.swift
Last active July 29, 2023 21:47
List of available frameworks in Swift Playgrounds over the years
// Swift Playgrounds Beta 1.0
import AVFoundation
import AVKit
import Accelerate
import Accounts
import AudioToolbox
import AudioUnit
import CFNetwork
import CoreAudio
import CoreAudioKit
@miikka
miikka / cheatsheet.rnc
Created January 12, 2016 19:54
RELAX NG compact syntax cheat sheet
# RELAX NG compact syntax cheat sheet
# See also:
# * tutorial <http://www.relaxng.org/compact-tutorial-20030326.html>
# * spec <http://www.relaxng.org/compact-20021121.html>
# Checking a XML file:
#
# jing -c schema.rnc file.xml
#