Skip to content

Instantly share code, notes, and snippets.

View chrismays's full-sized avatar

Chris Mays chrismays

View GitHub Profile
@chrismays
chrismays / SwiftUIDataUnitTest.swift
Created October 12, 2023 02:53 — forked from helje5/SwiftUIDataUnitTest.swift
Unit Testing a SwiftUI Query
//
// Created by Helge Heß.
// Copyright © 2023 ZeeZide GmbH.
//
import XCTest
import UIKit
import SwiftData
import SwiftUI
//
// A Swift property wrapper for adding "indirect" to struct properties.
// Enum supports this out of the box, but for some reason struct doesn't.
//
// This is useful when you want to do something recursive with structs like:
//
// struct Node {
// var next: Node?
// }
//
import SwiftUI
struct ContentView: View {
@State var horizontal: Bool = true
@Namespace var namespace
var body: some View {
VStack(spacing: 40) {
if horizontal {
HStack { items }
private struct OnFirstAppear: ViewModifier {
let perform: () -> Void
let `else`: () -> Void
@State private var firstTime = true
func body(content: Content) -> some View {
content.onAppear {
if firstTime {
firstTime = false
@chrismays
chrismays / ThingsLogbookToDayOne.scpt
Created February 10, 2019 01:46
Add all items from the Things Logbook from yesterday to a Day One journal entry
set currentDate to date string of (current date)
set yesterday to date string of ((current date) - 1 * days)
set yesterdayLog to open for access POSIX file "/var/tmp/things.log" with write permission
write "Things Tasks Completed " & yesterday & "
" to yesterdayLog
tell application "Things3"
@chrismays
chrismays / LICENSE.txt
Created February 1, 2018 19:47 — forked from kjaymiller/text_to_things3.scptd
AppleScript Import Text to Things3
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
security_sheet.auto_filter = "A1:H1"
#define APP_BGCOLOR [UIColor whiteColor]
#define APP_TEXTCOLOR [UIColor blackColor]
benefitstatementcomments.html