Skip to content

Instantly share code, notes, and snippets.

@ole
ole / thirty-days-of-metal.md
Last active September 19, 2024 01:39
Warren Moore – Thirty Days of Metal
@stephancasas
stephancasas / close-other-vs-code-windows.jxa.js
Created April 20, 2023 22:46
Close all other VSCode windows
#!/usr/bin/env osascript -l JavaScript
function run(_) {
const pid = $.NSRunningApplication.runningApplicationsWithBundleIdentifier(
'com.microsoft.VSCode',
).firstObject.processIdentifier;
// Bring all VSCode windows to the current Mission Control view.
$.CGSProcessAssignToAllSpaces($.CGSMainConnectionID(), pid);
@stephancasas
stephancasas / new-file-using-app-dock-menu.jxa.js
Created April 6, 2023 00:19
AXUIElement JXA Objective-C Bridge Example
#!/usr/bin/env osascript -l JavaScript
const App = Application.currentApplication();
App.includeStandardAdditions = true;
ObjC.import('Cocoa');
ObjC.bindFunction('AXUIElementCreateApplication', ['id', ['unsigned int']]);
ObjC.bindFunction('AXUIElementCopyAttributeValue', [
'int',
@stephancasas
stephancasas / toggle-ventura-sidecar.jxa.js
Last active September 20, 2024 01:02
Toggle sidecar or screen mirroring from Control Center in macOS Ventura
#!/usr/bin/env osascript -l JavaScript
/**
* -----------------------------------------------------------------------------
* Activate Sidecar/Screen Mirroring from Control Center
* -----------------------------------------------------------------------------
*
* Created on February 17, 2023 by Stephan Casas
* Updated on May 18, 2023 by Stephan Casas
*
@siracusa
siracusa / Pro Display XDR at 120Hz bandwidth calculation.md
Last active April 28, 2024 03:07
Pro Display XDR at 120Hz bandwidth calculations

From Jonathan Dietz, Jr.:

Almost all new displays employ VESA Coordinated Video Timings using Reduced Blanking Timing Version 2 (CVT-RBv2) which adds a small amount of overhead to the video signal. This overhead includes 80 additional horizontal pixels and enough additional lines to meet the 460 µs minimum vertical blanking interval requirement. You can download an Excel spreadsheet from VESA that will do all the calculations for you, but the math is pretty simple:

460 / ((1000000 / [refresh rate in Hz] - 460) / [vertical resolution])

To get an integer number of lines, you round this result down and add 1. So for Pro Display XDR resolution at 120 Hz that would work out to:

460 / (1000000 / 120 - 460) / 3384) = 197.710 = 198 additional lines

@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active September 20, 2024 18:08
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@gadzhimari
gadzhimari / adobe_cc.md
Created November 22, 2018 11:29
Completely Remove Adobe from your Mac in 2 Steps

Step 1

Download and run the Adobe Creative Cloud Cleaner Tool, their multi-app uninstaller and wipe assistant. Adobe does recommend running individual application uninstallers first, your call. Click the Clean All option.

Step 2

Type a one line command in terminal find ~/ -iname "*adobe*" and it's shows up all files which match pattern.

To remove all files

`sudo rm -rf /Applications/Adobe* /Applications/Utilities/Adobe* /Library/Application\ Support/Adobe /Library/Preferences/com.adobe.* /Library/PrivilegedHelperTools/com.adobe.* /private/var/db/receipts/com.adobe.* ~/Library/Application\ Support/Adobe* ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.adobe* ~/Library/Application\ Support/CrashReporter/Adobe* ~/Library/Caches/Adobe ~/Library/Caches/com.Adobe.* ~/Library/Caches/com.adobe.* ~/Library/Cookies/com.adobe.* ~/Library/Logs/Adobe* ~/Librar

Fixing macOS 10.14, 10.15, 12

Dark main menu without the rest of dark mode

  1. Set Light mode
  2. defaults write -g NSRequiresAquaSystemAppearance -bool Yes
  3. Log out and log back in
  4. Set Dark mode