Skip to content

Instantly share code, notes, and snippets.

@amiorin
amiorin / README.md
Last active April 18, 2024 02:50
How to configure Home Row Mods with KMonad on macOS

Intro

Karabiner and KMonad are great open source software. Don't forget to support the authors and contributors.

If you want to try home row mods on OSX, don't use Karabiner but KMonad. KMonad is harder at the beginning but then it is easier than Karabiner. Creating layers in KMonad is trivial and without drawbacks, while it is impossible in Karabiner without drawbacks.

You need to compile a PR of the project. Install https://github.com/pqrs-org/Karabiner-DriverKit-VirtualHIDDevice/releases/download/v2.1.0/Karabiner-DriverKit-VirtualHIDDevice-2.1.0.pkg

@jamesmacfie
jamesmacfie / README.md
Created October 22, 2019 02:53
iTerm 2 - script to change theme depending on Mac OS dark mode

How to use

In iTerm2, in the menu bar go to Scripts > Manage > New Python Script

Select Basic. Select Long-Running Daemon

Give the script a decent name (I chose auto_dark_mode.py)

Save and open the script in your editor of choice.

@IsaacXen
IsaacXen / README.md
Last active April 16, 2024 15:54
(Almost) Every WWDC videos download links for aria2c.
@darrarski
darrarski / FormattedTextField.swift
Last active April 16, 2024 13:14
SwiftUI FormattedTextField - TextField with custom display/edit formatters
import SwiftUI
public struct FormattedTextField<Formatter: TextFieldFormatter>: View {
public init(_ title: String,
value: Binding<Formatter.Value>,
formatter: Formatter) {
self.title = title
self.value = value
self.formatter = formatter
}
@Evian-Zhang
Evian-Zhang / find_sdk_root.sh
Created June 15, 2022 09:03
Proper way to handle "ld: library not found for -lSystem" in macOS
SDKROOT=`/usr/bin/xcrun --show-sdk-path -sdk macosx`
as test.s -o test.o
ld test.o -lSystem -L $(SDKROOT)/usr/lib -o test
@gonzalezreal
gonzalezreal / ios-cell-registration-swift.md
Last active March 13, 2024 15:18
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@JonDouglas
JonDouglas / xamarinandroidbindings.md
Last active March 12, 2024 10:36
Xamarin Android Bindings Troubleshooting

Approaching a Xamarin.Android Bindings Case

1. Investigation

One of the best ways to investigate a problematic Xamarin.Android Binding is to first ensure you have the proper tooling available:

struct LazyView<Content: View>: View {
let build: () -> Content
init(_ build: @autoclosure @escaping () -> Content) {
self.build = build
}
var body: Content {
build()
}
}
@Amzd
Amzd / View+NSCursor.swift
Last active February 9, 2024 17:34
Set the cursor that is displayed when hovering a View. (macOS, SwiftUI)
import SwiftUI
extension View {
/// https://stackoverflow.com/a/61985678/3393964
public func cursor(_ cursor: NSCursor) -> some View {
self.onHover { inside in
if inside {
cursor.push()
} else {
NSCursor.pop()
@ebonhand09
ebonhand09 / asm6809.vim
Created September 3, 2011 10:14
6809 Assembler (CoCo) syntax coloring for Vim
" Vim syntax file
" Language: Motorola 6809 Assembler
" Maintainer: David Roper <ebonhand09@gmail.com>
"
" This was originally based on asm68k.vim by Steve Wall
"
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600