Skip to content

Instantly share code, notes, and snippets.

View colejd's full-sized avatar
🆒
beans

Jonathan Cole colejd

🆒
beans
View GitHub Profile
/**
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 / 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 {
@colejd
colejd / ModalView.swift
Last active August 9, 2023 03:05
NSView that closes itself when clicking outside
// MIT License - © 2017 Jonathan Cole.
import Cocoa
/**
A view with the ability to hide itself if the user clicks outside of it.
*/
class ModalView: NSView {
private var monitor: Any?