Skip to content

Instantly share code, notes, and snippets.

View colejd's full-sized avatar
🆒
beans

Jonathan Cole colejd

🆒
beans
View GitHub Profile
@colejd
colejd / View+Sync.swift
Last active October 27, 2022 15:21
View+Sync.swift
extension View {
/**
From here: https://www.youtube.com/watch?v=3a7tuhVpoTQ
More discussion here: https://stackoverflow.com/a/73590189
This method synchronizes two bindings so that updates to one
result in updates to the other.
**Why do this?**
Have you ever gotten this error? `Publishing changes from within view updates is not allowed, this will cause undefined behavior.`
/**
Adapted from here:
https://www.vadimbulavin.com/how-to-move-swiftui-view-when-keyboard-covers-text-field/
Use these publishers to know when the keyboard is about to hide or show.
As an example, you can use this to scroll a ScrollView automatically after
the keyboard shows, using the timing information provided here.
*/
import Combine
@colejd
colejd / basecamp-tracked-dark-mode-fix.css
Last active March 30, 2023 16:13
Stylus userstyle that fixes Basecamp Tracked in dark mode on Firefox
@-moz-document regexp("https:\\/\\/3.basecamp.com\\/.+#board") {
/*
* This is a CSS file that cleans up the look of Tracked for Basecamp on Dark Mode in Firefox (and probably other browsers).
* First, on Basecamp go to your settings and change the theme to dark mode or light mode - not auto.
* Auto doesn't set data-color-scheme, which Tracked uses to color its own components.
* Next, Install Stylus, then create a new style. Click "Import" in the top-left and paste this code in.
*/
:root {
@colejd
colejd / build-libopus-m1.sh
Created March 3, 2023 20:06 — forked from mmsarquis/build-libopus-m1.sh
Build Opus library on Mac M1 for multiple platforms
apple#!/bin/bash
VERSION="1.3.1"
SDKVERSION_IPHONE="14.5"
ARCHS_DEVICES_IPHONE="arm64e armv7"
ARCHS_SIMULATOR_IPHONE="x86_64 arm64"
SDKVERSION_WATCH="7.4"
ARCHS_DEVICES_WATCH="arm64_32 armv7k"