Skip to content

Instantly share code, notes, and snippets.

View cweirup's full-sized avatar

Chris Weirup cweirup

View GitHub Profile
@cmoulton
cmoulton / URLSession Calls in Swift 4
Last active December 18, 2023 02:31
URLSession Calls in Swift 4
func makeGetCall() {
// Set up the URL request
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1"
guard let url = URL(string: todoEndpoint) else {
print("Error: cannot create URL")
return
}
let urlRequest = URLRequest(url: url)
// set up the session
@kjaymiller
kjaymiller / text_to_things3.scptd
Last active October 7, 2021 22:24
AppleScript Import Text to Things3
on run {input, parameters}
set delimitedList to paragraphs of (input as string)
tell application "Things3"
repeat with currentTodo in reverse of delimitedList
set newToDo to make new to do with properties {name:currentTodo} at beginning of list "Inbox"
end repeat
end tell
end run
-- Create a dialog for the user to choose from
choose from list {"Create a New Folder", "Clear an Existing Folder"} with title "Tag Folders" with prompt "Warning: selecting 'Clear an Existing Folder' will delete all folder contents." default items "Create a New Folder" OK button name "OK" cancel button name "Cancel" multiple selections allowed "false" empty selection allowed "false"
-- Set a variable called listanswer to the result of the selection as text
set listanswer to result as text
if listanswer = "Create a New Folder" or listanswer = "Clear an Existing Folder" then
tell application "Finder"
set loc to choose folder "Choose Folder Location" with prompt "Choose Output Location"
if listanswer = "Clear an Existing Folder" then
@lsavino
lsavino / compilation-optimization.md
Last active January 28, 2026 15:35
Compiler Optimizations, Compiling Optimally, and Whole Modules

DEPRECATED for Xcode 10 🎈

(check out What's New in Swift at 11:40, slide 42)

Whole Module Compilation Optimizations: Why these terms are sometimes misleading

When you look up how to compile swift faster for debug builds, people very earnestly give advice that seems contradictory: you should "try using the whole module optimization flag," and also "never use whole module optimization for debugging". [^1]

This is confusing because some of us are using these two general words:

compilation: "turning text into an executable program"

@kylehowells
kylehowells / FreeSpaceViewController.swift
Created May 4, 2022 23:24
UIViewController subclass to show both the Settings app displayed free space, and the real free space.
//
// FreeSpaceViewController.swift
// Free Space
//
// Created by Kyle Howells on 04/05/2022.
//
import UIKit
class FreeSpaceViewController: UIViewController {