Skip to content

Instantly share code, notes, and snippets.

@kylehughes
kylehughes / .swift-format
Last active January 2, 2026 11:31
The perfect, comprehensive swift-format (600.0.0) configuration.
{
"indentBlankLines": false,
"indentConditionalCompilationBlocks": false,
"indentSwitchCaseLabels" : false,
"indentation": {
"spaces": 4
},
"lineBreakAroundMultilineExpressionChainComponents": true,
"lineBreakBeforeControlFlowKeywords": false,
"lineBreakBeforeEachArgument": true,
#!/usr/bin/env fish
# Needs rg: `brew install ripgrep`
set -xg visitedLibs
function libdeps -a bin depth -d "Finds all dylibs that a binary depends on recursively and prints them on separate lines, sorted alphabetically"
if test -z "$depth"
set depth 0
end
@flbn
flbn / NousApp.swift
Created March 17, 2023 00:44
hide toolbar (focus mode)
private struct IsFocusedKey: EnvironmentKey {
static let defaultValue: Bool = false
}
extension EnvironmentValues {
var isFocused: Bool {
get { self[IsFocusedKey.self] }
set { self[IsFocusedKey.self] = newValue }
}
}
@sindresorhus
sindresorhus / esm-package.md
Last active March 16, 2026 04:38
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
import SwiftUI
class Coordinator: ObservableObject {
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
init() {
let view = NSHostingView(rootView: Text("Hello from SwiftUI").fixedSize())
item.button?.addSubview(view)
view.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
import Foundation
struct ProjectUser: Codable {
var id: Int
enum CodingKeys: String, CodingKey {
case id = "userId"
}
}

Fixing macOS 10.14, 10.15, 12

Dark main menu without the rest of dark mode

  1. Set Light mode
  2. defaults write -g NSRequiresAquaSystemAppearance -bool Yes
  3. Log out and log back in
  4. Set Dark mode

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals

@sagivo
sagivo / gist:3a4b2f2c7ac6e1b5267c2f1f59ac6c6b
Last active March 15, 2026 05:59
webRTC stun / turn server list
to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice
stun:
stun.l.google.com:19302,
stun1.l.google.com:19302,
stun2.l.google.com:19302,
stun3.l.google.com:19302,
stun4.l.google.com:19302,
stun.ekiga.net,
stun.ideasip.com,