Skip to content

Instantly share code, notes, and snippets.

View narciszait's full-sized avatar

Narcis narciszait

  • App developer
  • Copenhagen, Denmark
View GitHub Profile
@oronbz
oronbz / hook_allow_mcp.js
Created March 5, 2026 09:19 — forked from igor-makarov/hook_allow_mcp.js
Auto-approve annoying Xcode 26.3 MCP prompts
#!/usr/bin/env osascript -l JavaScript
// Find and approve any MCP agent access dialogs in Xcode.
function run() {
var se = Application("System Events");
try { se.processes.byName("Xcode").name(); } catch (e) { return "Xcode not running."; }
var count = 0;
var windows = se.processes.byName("Xcode").windows();
//
// ListeningVoiceAnimation.swift
//
// Created by Amos Gyamfi on 12.12.2025.
//
import SwiftUI
struct ListeningVoiceAnimation: View {
import SwiftUI
extension HabitCard {
var barChart: some View {
Capsule()
.fill(.quaternary)
.overlay {
GeometryReader { geometry in
let height = geometry.size.height
Capsule()
@michael94ellis
michael94ellis / SwiftUIAppToaster.swift
Last active June 11, 2025 11:10
A simple way to show a toast in SwiftUI apps over all other view activity.
// Inspired by Federico Zanetello
// https://www.fivestars.blog/articles/swiftui-windows/
import UIKit
import SwiftUI
struct ToastView: View {
let message: String
/// Total duration that the toast will be visible on screen
let duration: TimeInterval
@SKaplanOfficial
SKaplanOfficial / now-playing.js
Last active March 24, 2026 14:43
AppleScript and JXA scripts to get Now Playing info. Works on macOS 15.4+, including macOS 26 beta 1.
function run() {
const MediaRemote = $.NSBundle.bundleWithPath('/System/Library/PrivateFrameworks/MediaRemote.framework/');
MediaRemote.load
const MRNowPlayingRequest = $.NSClassFromString('MRNowPlayingRequest');
const appName = MRNowPlayingRequest.localNowPlayingPlayerPath.client.displayName;
const infoDict = MRNowPlayingRequest.localNowPlayingItem.nowPlayingInfo;
const title = infoDict.valueForKey('kMRMediaRemoteNowPlayingInfoTitle');
import SwiftUI
struct HarmonicButton: View {
var body: some View {
Button(
action: {},
label: {}
)
.frame(width: 240.0, height: 70.0)
.buttonStyle(HarmonicStyle())
@JuniperPhoton
JuniperPhoton / FloatingOverlayApp.swift
Last active March 31, 2025 08:47
A simple application to show a black, resizable, title-less, always-on-top NSWindow on Mac.
//
// FloatingOverlayApp.swift
// FloatingOverlay
//
// Created by JuniperPhoton on 2025/3/12.
//
import SwiftUI
// Dependency: https://github.com/sindresorhus/KeyboardShortcuts
@harlanhaskins
harlanhaskins / View+ParentViewController.swift
Last active July 27, 2025 21:39
A SwiftUI modifier for inserting the parent UIViewController in the environment
import Foundation
import SwiftUI
extension View {
/// Adds introspection to find the parent view controller in the view hierarchy and
/// makes that view controller available to downstream views in the view hierarchy.
public func addParentViewControllerIntrospection() -> some View {
modifier(ParentViewControllerEnvironmentModifier())
}
}
@unixzii
unixzii / ForceEnablingXcodeLLM.md
Last active March 20, 2026 12:48
A guide to force enabling Xcode LLM feature on China-SKU Macs.

Introduction

Apple restricted the access to Xcode LLM (Predictive code completion) feature on China models of Mac. This guide provides a way to bypass that restriction. It's verified on macOS 15.0 Beta (24A5264n), but there is no guarentee that it will always work on later macOS versions.

Prerequisites

  • Xcode is installed and run at least once.
  • SIP debugging restrictions are disabled (via csrutil enable --without debug command in recovery mode).

Disclaimer

import SwiftUI
struct SizePreferenceKey: PreferenceKey {
static var defaultValue: CGSize = .zero
static func reduce(value: inout CGSize, nextValue: () -> CGSize) {}
}
public extension View {
func readSize(onChange: @escaping (CGSize) -> Void) -> some View {
self