Skip to content

Instantly share code, notes, and snippets.

kitx / ProgrammaticTableView.swift
Last active July 28, 2022 02:30
A complete example showing how to construct an NSTableView programmatically (no NIB!) and take care of the small issues like column spacing. Complete description of this example here:
View ProgrammaticTableView.swift
import AppKit
import PlaygroundSupport
let tableViewFrame = NSRect(x: 0, y: 0, width: 250, height: 500)
class TableViewController: NSViewController {
let tableView: NSTableView = {
let tableView = NSTableView()
// By default a tableview has column spacing. We only have
kitx / ReorderTableView.swift
Last active March 12, 2021 11:24
Programmatically reordering a table view on macOS using drag and drop. A full example in this Playground, with setup and tear down code. For a detailed guide to how this works, see:
View ReorderTableView.swift
import Cocoa
import PlaygroundSupport
class BackgroundView: NSView {
override func draw(_ dirtyRect: NSRect) {
kitx / gist:ab78da97254fd1e2b2f0abc9578d8c56
Last active March 12, 2021 11:26
Using wget to download Apple beta releases
View gist:ab78da97254fd1e2b2f0abc9578d8c56
TOKEN is from ADCDownloadAuth cookie (get it from web inspector storage)
URL is resolved file url on the CDN
wget -x --header "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" \
--header "Upgrade-Insecure-Requests: 1" \
--header "Cookie: ADCDownloadAuth={TOKEN}" \
--header "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B72 Safari/602.1" \
--header "Accept-Language: en-us" "{URL}"
View 2014 UCR Counties with more than 70 percent ORIs reporting.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.