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 / 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"
@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 {
/**
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 / 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.`
@colejd
colejd / PinningToCorner.swift
Created January 28, 2022 18:20
SwiftUI View that fills space and pins its contents to a given corner
//
// PinningToCorner.swift
// No license, go wild.
//
import SwiftUI
struct PinningToCorner<Content: View>: View {
enum Corner {
case topLeading
@colejd
colejd / Davider.swift
Last active January 27, 2022 19:07
Horizontal SwiftUI divider with content embedded in center
/// Embeds its content between two horizontal dividers.
struct Davider<Content: View>: View {
let content: Content
init(@ViewBuilder content: () -> Content) {
self.content = content()
}
var body: some View {
HStack {
echo "Building for iOS..."
xcodebuild archive \
-sdk iphoneos IPHONEOS_DEPLOYMENT_TARGET=9.0 \
-arch armv7 -arch arm64 \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
-scheme "ExampleLibrary" \
-archivePath "./build/iphoneos/ExampleLibrary.xcarchive" SKIP_INSTALL=NO
əˈkɔrdɪŋ tu ɔl noʊn lɔz
ʌv ˌeɪviˈeɪʃən,
ðɛr ɪz noʊ weɪ ə bi
ʃʊd bi ˈeɪbəl tu flaɪ.
ɪts wɪŋz ɑr tu smɔl tu gɛt
ɪts fæt ˈlɪtəl ˈbɑdi ɔf ðə graʊnd.
@colejd
colejd / San Francisco internal variant names.txt
Created September 16, 2019 15:40
San Francisco Internal Font Variants (dumped from Xcode 10)
.SFUI-Black
.SFUI-BlackItalic
.SFUI-Bold
.SFUI-BoldItalic
.SFUI-Heavy
.SFUI-HeavyItalic
.SFUI-Light
.SFUI-LightItalic
.SFUI-Medium
.SFUI-MediumItalic
@colejd
colejd / userChrome.css
Created February 12, 2019 20:54
UserChrome for hiding tab bar in conjunction with the Tree Tabs extension
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
/* Hide all tabs (but not tab bar) when windowed. Preserves area for window controls (tested on macOS). */
/*#TabsToolbar {
visibility: collapse !important;
}*/
/* Hide the whole tab bar in fullscreen */
#TabsToolbar[inFullscreen] {
visibility: collapse !important;