Skip to content

Instantly share code, notes, and snippets.

@ashwch
ashwch / git-worktrees-zero-to-hero.md
Last active January 9, 2026 18:52
Git Worktrees: From Zero to Hero - A comprehensive guide to using Git worktrees with submodules
@Explosion-Scratch
Explosion-Scratch / Web Search Navigator.user.js
Last active January 9, 2026 13:17
Web Search Navigator Userscript
// ==UserScript==
// @name Web Search Navigator
// @version 0.5.2
// @description Keyboard shortcuts for Google search, YouTube, Startpage, Brave Search, Google Scholar, Github, Gitlab, and Amazon.
// @author Web Search Navigator
// @iconURL data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0T///////8JWPfcAAAAB3RJTUUH4goDFzU3zLh1KgAABfpJREFUSMe1lWtQVecZhZ/32/scDgdB4HiFgKihgjbiddC2RKI1GkOisbYkRpPaasOUJJ2AbVqNQ7zGCxoTpY4TMwaimEQNNYmoVWtHra2tiUxVIt7QAt4KgnDg3PbeX3/UzFhn+jPPv3dmrZn1412zhAc49PThxMPnwF/mX9W5CDLJzMycAa4JrslmHmBgYAAa/T9GQQCIJVbiwC9+f8cNqNxYOaryPPSY7ivosRDmN8yfUXzsftsDaK211rjvneHzc+pyL6S5lnk2eyo8n5hBGmmkka/RD0SQ/0aQbLIZQ8adta0LWgusycNfGLYq67NIzj2VKSIigvWNzXwwQPuFjnP+GsJ2ib3Qfj19U8qvU0pTPnkrSnbJUanr+QtChAhpxf9jF2HqeC9xtq/Cd+LOntrA1/r8j97w+Tb7dvmO1LY8KDdHuZb0bG0C3aLPsBuMrUbIXALaq706Or3GWG28bZQ9U8IHVMiHKoIfv+4EIkSIABYOgEyVLBSoIlkiw0B9Kn9jCTlGvmpU+7b39Q72XvROqm0Z+fvFz98pAhkn70k/UJ5c
@fatbobman
fatbobman / dynamicHeightSheet.swift
Created April 5, 2024 06:59
a dynamic sheet demo
import SwiftUI
struct ContentView: View {
@State var show = false
@State var height: CGFloat = 250
var body: some View {
List {
Button("Pop Sheet") {
height = 250
show.toggle()
@NoahKamara
NoahKamara / CompoundPredicate.swift
Last active November 12, 2025 16:41
Combining New Swift Predicates
import Foundation
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
/// Allows you to use an existing Predicate as a ``StandardPredicateExpression``
struct VariableWrappingExpression<T>: StandardPredicateExpression {
let predicate: Predicate<T>
let variable: PredicateExpressions.Variable<T>
func evaluate(_ bindings: PredicateBindings) throws -> Bool {
// resolve the variable
@hoishing
hoishing / HowTo.md
Last active January 16, 2026 14:39
VSCode keybindings for Xcode

VSCode keybindings for Xcode

  • copy VSCode.idekeybindings to ~/Library/Developer/Xcode/UserData/KeyBindings
  • in Xcode preferences -> key bindings, select VSCode
@jakub-g
jakub-g / README.md
Last active December 26, 2025 12:19
Karabiner-Elements: Remap cmd-capslock to cmd-backtick(tilde) (Switch window within an app)

What this rule does

On MacOS, cmd-tab only toggles between different apps. To toggle between different windows of the same app, you need to use cmd-` . However this is cumbersome for regular usage, as it requires stretching your fingers unnaturally. This rule allows to use cmd-CapsLock instead, which is much easier.

To enable the rule

  • Install Karabiner Elements and give it all permissions it asks for
  • cd ~/.config/karabiner/assets/complex_modifications and put the json file below there
  • Restart Karabiner Elements
  • Go to "Complex Modifications > Add rule"
@byrontuckett
byrontuckett / caps-lock-remap-macos.md
Last active December 26, 2025 12:18
How to remap caps lock to backspace in macOS

Remap useless caps lock buttopn to backspace.

Tested on macOS 12.5 Use at own risk

Run this command to set caps lock keyboard button to the backspace

Note this is not persistent. You will need to do this on each boot or add to your boot procedure/profile.

@notDavid
notDavid / preventKeyboardShortcutHijacking-user.js
Last active December 26, 2025 04:37
A userscript to prevent websites from hijacking browser keyboard shortcuts
// ==UserScript==
// @name Prevent keyboard shortcut hijacking
// @description Prevent websites to hijack keyboard shortcuts, for example <Ctrl+F> on Discourse
// @namespace Violentmonkey Scripts
// @match *://*/*
// @grant none
// @version 1.0
// @author notDavid
// ==/UserScript==
extension Task where Failure == Error {
// Start a new Task with a timeout. If the timeout expires before the operation is
// completed then the task is cancelled and an error is thrown.
init(priority: TaskPriority? = nil, timeout: TimeInterval, operation: @escaping @Sendable () async throws -> Success) {
self = Task(priority: priority) {
try await withThrowingTaskGroup(of: Success.self) { group -> Success in
group.addTask(operation: operation)
group.addTask {
try await _Concurrency.Task.sleep(nanoseconds: UInt64(timeout * 1_000_000_000))
@bennlee
bennlee / remapping-keys-via-hidutil.md
Created November 19, 2021 05:39
How to remapping keys on macOS without thirdparty applications.

How to remapping keys on macOS without thirdparty applications.

You could remapping keys via the macOS embedded command line tool hidutil.


Key IDs Table
Usage Usage ID (hex) Usage Usage ID (hex) Usage Usage ID (hex) Usage Usage ID (hex)