Skip to content

Instantly share code, notes, and snippets.

class FloatingPanel: NSPanel {
init(contentRect: NSRect, backing: NSWindow.BackingStoreType, defer flag: Bool) {
// Not sure if .titled does affect anything here. Kept it because I think it might help with accessibility but I did not test that.
super.init(contentRect: contentRect, styleMask: [.nonactivatingPanel, .resizable, .closable, .fullSizeContentView], backing: backing, defer: flag)
// Set this if you want the panel to remember its size/position
// self.setFrameAutosaveName("a unique name")
// Allow the pannel to be on top of almost all other windows
@fhefh2015
fhefh2015 / CustomDashedView.swift
Created June 24, 2021 02:03
CustomDashedView
//
// DashedBorderView.swift
// AInOne
//
// Created by Apple on 2021/6/23.
//
import UIKit
class DashedBorderView: UIView {
@meddokss
meddokss / Styled-components-error.md
Last active January 13, 2025 18:13
[Styled-components Error] Warning: React does not recognize the prop on a DOM element. #STYLED
Warning: React does not recognize the `isEditing` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `isediting` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    in button (created by ForwardRef(Tab))
    in ForwardRef(Tab) (created by Context.Consumer)
    in StyledComponent (created by Styled(Component))
    in Styled(Component) (at App.js:14)

In the TextBox component you're passing all the props from the parent via {...props}. Considering that TextField itself doesn't have 'isEditing' property, I assume it passes it down to the underlying input DOM element, which doesn't recognise that prop.

@cupnoodle
cupnoodle / toggleSync.md
Last active November 13, 2023 15:11
Disable sync of NSPersistentCloudKitContainer at launch, then enable sync later

To disable iCloud sync of core data when the app launches, set the cloudKitContainerOptions to nil for the persistent store.

In your AppDelegate.swift file :

lazy var persistentContainer: NSPersistentCloudKitContainer = {

        let container = NSPersistentCloudKitContainer(name: "your core data container name")
        
        guard let description = container.persistentStoreDescriptions.first else {
            fatalError("###\(#function): Failed to retrieve a persistent store description.")
@aerobounce
aerobounce / macOS System Preference Pane Links.md
Last active August 23, 2024 20:54
macOS System Preference Pane Links
@rmcdongit
rmcdongit / macOS_SytemPrefs.md
Last active April 22, 2025 07:29
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
@a1ip
a1ip / hostname.md
Last active April 9, 2025 12:00
How to set the Mac hostname or computer name from the terminal

How to set the Mac hostname or computer name from the terminal

  1. Open a terminal.
  2. Type the following command to change the primary hostname of your Mac: This is your fully qualified hostname, for example myMac.domain.com
sudo scutil --set HostName <new host name>
  1. Type the following command to change the Bonjour hostname of your Mac: This is the name usable on the local network, for example myMac.local.
@evici
evici / default-finder-view
Created January 16, 2020 18:28
Set Default Finder View and Arrange By Options
1. Backup com.apple.finder.plist
cp ~/Library/Preferences/com.apple.finder.plist ~/Desktop
2. Set top-level defaults using the defaults command
Default to list view:
defaults write com.apple.finder FXPreferredViewStyle Nlsv
Default Arrange By flags that don't seem to be effective:
defaults write com.apple.finder FXArrangeGroupViewBy kind
defaults write com.apple.finder FXPreferredGroupBy kind