Skip to content

Instantly share code, notes, and snippets.

@js
js / ghostty config
Last active September 1, 2025 13:05
keybind = super+shift+right=next_tab
keybind = super+shift+left=previous_tab
macos-option-as-alt = right
keybind = alt+left=unbind
keybind = alt+right=unbind
keybind = alt+8=unbind
keybind = alt+9=unbind
#font-family = Iosevka NFM
@js
js / iOS26SearchableSafeAreaBug.swift
Created June 27, 2025 07:10
iOs 26 top safe area inset with searchable visual bug
import SwiftUI
struct SearchableSafeAreaBug: View {
@State private var searchText = ""
var body: some View {
List {
ForEach(0...25, id: \.self) { number in
Label("Number \(number)", systemImage: "star")
}
//
// BlurReplalce.swift
// SwiftUI Scratchpad
//
// Created by Johan Sørensen on 07/05/2024.
//
import SwiftUI
@available(iOS 17.0, *)
import SwiftUI
final actor Worker: ObservableObject {
@MainActor @Published private(set) var lastWorkDoneAt: Date?
private var counter = 0
func doWork() {
self.counter += 1
DispatchQueue.main.async {
self.lastWorkDoneAt = .now
}
import SwiftUI
struct UnderConstructionModifier: ViewModifier {
func body(content: Content) -> some View {
content
.redacted(reason: .placeholder)
.blur(radius: 8)
.overlay(Color.pink.opacity(0.33))
.overlay(
Text("🚧🚧🚧")
import SwiftUI
@available(iOS, deprecated: 16.0, message: "Use SwiftUI.scrollContentBackground()")
struct HidesScrollContentBackground: ViewModifier {
init() {
if #unavailable(iOS 16.0) {
// beware, affects the app-global appearance proxy:
// UITableView.appearance().backgroundColor = .clear
}
}
import UIKit
let json1 = """
{"results": [{"name": "bob"}]}
""".data(using: .utf8)!
let json2 = """
{"people": [{"name": "Jane"}]}
""".data(using: .utf8)!
import UIKit
enum Item: Codable {
case int(Int)
case string(String)
private enum CodingKeys: String, CodingKey {
case kind
case value
}
@js
js / .gitconfig
Last active May 22, 2019 10:05
fuzzy selection of git branch, files to (un)stage using https://github.com/lotabout/skim
....
[alias]
sel = select
asel = add-select
rsel = reset-select
...
#!/bin/sh
git log --no-walk --date-order --oneline --decorate $(git rev-list --branches --no-walk)