Skip to content

Instantly share code, notes, and snippets.

@Cykelero
Cykelero / UndoAssertManager.swift
Created March 20, 2023 17:24
Easily test undo/redo in an AppKit app.
//
// UndoAssertManager.swift
// RetconTests
//
// Created by Nathan Manceaux-Panot on 2022-10-23.
//
import Foundation
import AppKit
@Cykelero
Cykelero / buttonWithinAlertExtension.swift
Created March 7, 2023 14:23
A tiny extension to make switching on NSAlert responses easier
extension NSApplication.ModalResponse {
func button(within alert: NSAlert) -> NSButton? {
let buttonIndex =
self.rawValue
- NSApplication.ModalResponse.alertFirstButtonReturn.rawValue
return alert.buttons[safeIndex: buttonIndex]
}
}
@Cykelero
Cykelero / clear-stackoverflow.css
Created November 9, 2022 22:03
CSS styles to remove a lot of the distractions on StackExchange sites.
body.unified-theme {
padding-top: 10px !important;
}
.unified-theme header {
display: none !important;
}
.unified-theme #left-sidebar {
display: none;
@Cykelero
Cykelero / clear-example.js
Created August 20, 2019 08:06
A very simple script: written in Tasklemon, and written with the built-in Node.js APIs
// Tasklemon
home.children.forEach(child => {
if (child.extension === 'tmp') child.delete();
});
// Node.js
const fs = require('fs');
const os = require('os');
const path = require('path');