Skip to content

Instantly share code, notes, and snippets.

View interstateone's full-sized avatar
👋

Brandon Evans interstateone

👋
View GitHub Profile
@schwa
schwa / flick.swift
Last active October 15, 2022 00:18
Flick Gesture
import PlaygroundSupport
import SwiftUI
PlaygroundPage.current.setLiveView(ContentView())
struct ContentView: View {
var body: some View {
Color.white.frame(width: 600, height: 800).touchVisualizer()
}
}
@zhuowei
zhuowei / unpackpdx.py
Last active January 2, 2024 10:43
Unpacks a .pdx/.pdz file from the PlayDate
import sys
import os
import zlib
with open(sys.argv[1], "rb") as infile:
indata = infile.read()
magic = b"Playdate PDX\0\0\0\0"
magic_new = b"Playdate PDZ\0\0\0\0"
if not indata[0:len(magic)] in [magic, magic_new]:
@saagarjha
saagarjha / imessage_cleanup.py
Created April 26, 2021 03:12
Helps clean up large iMessage attachments by letting you search for them
#!/usr/bin/env python3
import pathlib
import sqlite3
if __name__ == "__main__":
connection = sqlite3.connect(f"{pathlib.Path.home()}/Library/Messages/chat.db")
for (name, size, chat, date) in connection.execute("""
SELECT transfer_name, total_bytes, chat_message_join.chat_id, date
FROM message_attachment_join JOIN message ON message_attachment_join.message_id = message.ROWID
@helje5
helje5 / SparkleCommands.swift
Last active January 11, 2023 00:37
How to hookup Sparkle in SwiftUI
//
// SparkleCommands.swift
// Past for iChat
//
// Created by Helge Heß on 08.04.21.
//
import SwiftUI
#if SPARKLE && canImport(Sparkle)

This page is now depreacted!

Check out the repo instead. The Wisdom of Quinn Now with 100% more archived PDFs.

The Wisdom of Quinn

Informative DevForum posts from everyone's favorite DTS member.

(Arranged newest to oldest)

import SwiftUI
import UIKit
enum ScalableFont {
case system(size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default)
case custom(_ name: String, size: CGFloat)
var size: CGFloat {
@DeFrenZ
DeFrenZ / AppDelegate.swift
Created November 14, 2020 23:59
Dependency Injection a-la SwiftUI.Environment style by (ab)using the responder chain
import UIKit
@main
final class AppDelegate: UIResponder, UIApplicationDelegate {
private let testService: TestService = .init()
func application(
_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions) -> UISceneConfiguration
@IanKeen
IanKeen / Example_Complex.swift
Last active January 23, 2024 07:53
PropertyWrapper: @transaction binding for SwiftUI to make changes to data supporting commit/rollback
struct User: Equatable {
var firstName: String
var lastName: String
}
@main
struct MyApp: App {
@State var value = User(firstName: "", lastName: "")
@State var showEdit = false
@ddddxxx
ddddxxx / KeyPath+fieldName.swift
Last active April 28, 2023 10:24
KeyPath Introspection
// This file is based largely on the Runtime package - https://github.com/wickwirew/Runtime
extension KeyPath {
var fieldName: String? {
guard let offset = MemoryLayout<Root>.offset(of: self) else {
return nil
}
let typePtr = unsafeBitCast(Root.self, to: UnsafeMutableRawPointer.self)
let metadata = typePtr.assumingMemoryBound(to: StructMetadata.self)
@jsloat
jsloat / Bear.Backlinks.js
Last active December 27, 2022 23:27
Generate backlinks for Bear notes in Scriptable on iOS