Skip to content

Instantly share code, notes, and snippets.

View finestructure's full-sized avatar

Sven A. Schmidt finestructure

View GitHub Profile
clean:
@# just delete specific directories instead of .builds so we don't
@# have to re-fetch dependencies
@rm -f .build/debug
@rm -rf .build/x86_64-apple-macosx/
@rm -rf .build/x86_64-unknown-linux/
@rm -rf .build/x86_64-unknown-linux-gnu/
macos-spm-4.2: clean
@echo
// See: https://www.swiftbysundell.com/tips/inline-wrapping-of-uikit-or-appkit-views-within-swiftui/
import SwiftUI
#if os(iOS)
public struct Wrap<Wrapped: UIView>: UIViewRepresentable {
public typealias Updater = (Wrapped, Context) -> Void
var makeView: () -> Wrapped
@finestructure
finestructure / test_run.swift
Created April 9, 2020 15:27
Test for adapting a progress handler to Effect.subject
import Combine
import ComposableArchitecture
import ComposableArchitectureTestSupport
import XCTest
class MainViewTests: XCTestCase {
func test_run() throws {
// Setup
struct State: Equatable {
var busy = false
@finestructure
finestructure / CAProtocols.swift
Last active April 14, 2020 07:58
"Guidance protocols" for Composable Architecture
//
// CAProtocols.swift
// RequirementEditor
//
// Created by Sven A. Schmidt on 29/03/2020.
// Copyright © 2020 finestructure. All rights reserved.
//
import SwiftUI
// Playground generated with 🏟 Arena (https://github.com/finestructure/arena)
// ℹ️ If running the playground fails with an error "no such module ..."
// go to Product -> Build to re-trigger building the SPM package.
// ℹ️ Please restart Xcode if autocomplete is not working.
// Created by running
// arena git@github.com:stephencelis/swift-composable-architecture.git@revision:63b04f284a557d36d5c09d60dafb6e016b3432b8 -n text-field
import ComposableArchitecture
import ComposableArchitectureTestSupport
@finestructure
finestructure / Readme.md
Last active June 23, 2020 03:09
Homebrew app release
@finestructure
finestructure / dispatchMain.swift
Created February 10, 2020 06:30
Swift scripting example use of dispatchMain
#!/usr/bin/env swift
import Foundation
import Dispatch
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
print("Done.")
exit(EXIT_SUCCESS)
}
@finestructure
finestructure / make-spm-playground.sh
Last active August 12, 2020 01:19
Make a playground with access to an SPM library ready for importing
#!/usr/bin/env bash
set -eux
PROJ_NAME=myproj2
PKG_URL=https://github.com/johnsundell/plot.git
PKG_FROM=0.1.0
LIB_NAME=Plot
SWIFT_VERSION=5.1.3
PLATFORM=macos
# Run with Rester: https://github.com/finestructure/Rester
variables:
BASE_URL: https://api.github.com/repos/brentsimmons/NetNewsWire
requests:
releases:
url: ${BASE_URL}/releases
headers:
# If you're getting rate limited by the Github API, run this
# restfile with a Github token.
# Uncomment the line starting with "Authorization:" below and
! ◰³ james ~/P/E/james ⎇ develop *$- backend pytest tests/test_magic_links.py::MagicLinkTests::test_reuse_2
=========================================================================================================================== test session starts ===========================================================================================================================
platform darwin -- Python 3.7.2, pytest-4.6.2, py-1.8.0, pluggy-0.12.0
Django settings: test_settings (from ini file)
rootdir: /Users/sas/Projects/Enervolution/james/backend, inifile: setup.cfg
plugins: django-3.5.0
collected 1 item
tests/test_magic_links.py
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO